From bfe73fd683053201c326f9ff2c8e5e0f69cc7fe7 Mon Sep 17 00:00:00 2001 From: imp Date: Wed, 16 Sep 1998 04:17:47 +0000 Subject: Replace memory leaking instances of realloc with non-leaking reallocf. In some cases replace if (a == null) a = malloc(x); else a = realloc(a, x); with simple reallocf(a, x). Per ANSI-C, this is guaranteed to be the same thing. I've been running these on my system here w/o ill effects for some time. However, the CTM-express is at part 6 of 34 for the CAM changes, so I've not been able to do a build world with the CAM in the tree with these changes. Shouldn't impact anything, but... --- lib/libss/help.c | 2 +- lib/libss/invocation.c | 2 +- lib/libss/parse.c | 2 +- lib/libss/request_tbl.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/libss') diff --git a/lib/libss/help.c b/lib/libss/help.c index 48aece43..078224d 100644 --- a/lib/libss/help.c +++ b/lib/libss/help.c @@ -111,7 +111,7 @@ void ss_add_info_dir(sci_idx, info_dir, code_ptr) dirs = info->info_dirs; for (n_dirs = 0; dirs[n_dirs] != (char *)NULL; n_dirs++) ; /* get number of non-NULL dir entries */ - dirs = (char **)realloc((char *)dirs, + dirs = (char **)reallocf((char *)dirs, (unsigned)(n_dirs + 2)*sizeof(char *)); if (dirs == (char **)NULL) { info->info_dirs = (char **)NULL; diff --git a/lib/libss/invocation.c b/lib/libss/invocation.c index 513ec7d..f56c01a 100644 --- a/lib/libss/invocation.c +++ b/lib/libss/invocation.c @@ -37,7 +37,7 @@ int ss_create_invocation(subsystem_name, version_string, info_ptr, for (sci_idx = 1; table[sci_idx] != (ss_data *)NULL; sci_idx++) ; - table = (ss_data **) realloc((char *)table, + table = (ss_data **) reallocf((char *)table, ((unsigned)sci_idx+2)*size); table[sci_idx+1] = (ss_data *) NULL; table[sci_idx] = new_table; diff --git a/lib/libss/parse.c b/lib/libss/parse.c index 8a61ea8..878677e 100644 --- a/lib/libss/parse.c +++ b/lib/libss/parse.c @@ -31,7 +31,7 @@ enum parse_mode { WHITESPACE, TOKEN, QUOTED_STRING }; * Series of pointers to parsed tokens. */ -#define NEW_ARGV(old,n) (char **)realloc((char *)old,\ +#define NEW_ARGV(old,n) (char **)reallocf((char *)old,\ (unsigned)(n+2)*sizeof(char*)) char **ss_parse (sci_idx, line_ptr, argc_ptr) diff --git a/lib/libss/request_tbl.c b/lib/libss/request_tbl.c index b860064..1564689 100644 --- a/lib/libss/request_tbl.c +++ b/lib/libss/request_tbl.c @@ -25,7 +25,7 @@ ss_add_request_table(sci_idx, rqtbl_ptr, position, code_ptr) ; /* size == C subscript of NULL == #elements */ size += 2; /* new element, and NULL */ - info->rqt_tables = (ssrt **)realloc((char *)info->rqt_tables, + info->rqt_tables = (ssrt **)reallocf((char *)info->rqt_tables, (unsigned)size*sizeof(ssrt)); if (info->rqt_tables == (ssrt **)NULL) { *code_ptr = errno; -- cgit v1.1