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/libc/regex/regcomp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/libc/regex/regcomp.c') diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 8bb1355..67fdf47 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -1185,12 +1185,12 @@ register struct parse *p; if (p->g->sets == NULL) p->g->sets = (cset *)malloc(nc * sizeof(cset)); else - p->g->sets = (cset *)realloc((char *)p->g->sets, + p->g->sets = (cset *)reallocf((char *)p->g->sets, nc * sizeof(cset)); if (p->g->setbits == NULL) p->g->setbits = (uch *)malloc(nbytes); else { - p->g->setbits = (uch *)realloc((char *)p->g->setbits, + p->g->setbits = (uch *)reallocf((char *)p->g->setbits, nbytes); /* xxx this isn't right if setbits is now NULL */ for (i = 0; i < no; i++) @@ -1331,7 +1331,7 @@ register char *cp; if (cs->multis == NULL) cs->multis = malloc(cs->smultis); else - cs->multis = realloc(cs->multis, cs->smultis); + cs->multis = reallocf(cs->multis, cs->smultis); if (cs->multis == NULL) { SETERROR(REG_ESPACE); return; @@ -1365,7 +1365,7 @@ register char *cp; return; } - cs->multis = realloc(cs->multis, cs->smultis); + cs->multis = reallocf(cs->multis, cs->smultis); assert(cs->multis != NULL); } -- cgit v1.1