Minor memory leaks in cnfs/buffindexed
Alex Kiernan
alexk at demon.net
Mon Feb 12 07:14:55 UTC 2001
The config parsers in these leak memory when you've got comments in
the file (still waiting for my inbound feed to realise my server's
back so that purify gets interesting...):
Index: cnfs/cnfs.c
===================================================================
RCS file: /upstream-repositories/inn-cvs.isc.org/inn/storage/cnfs/cnfs.c,v
retrieving revision 1.81
diff -u -r1.81 cnfs.c
--- cnfs/cnfs.c 2001/02/02 17:56:07 1.81
+++ cnfs/cnfs.c 2001/02/12 07:11:58
@@ -721,10 +721,6 @@
return FALSE;
}
for (from = to = config; *from; ) {
- if (ctab_free == 0)
- ctab = NEW(char *, 1);
- else
- RENEW(ctab, char *, ctab_free+1);
if (*from == '#') { /* Comment line? */
while (*from && *from != '\n')
from++; /* Skip past it */
@@ -735,6 +731,10 @@
from++;
continue; /* Back to top of loop */
}
+ if (ctab_free == 0)
+ ctab = NEW(char *, 1);
+ else
+ RENEW(ctab, char *, ctab_free+1);
/* If we're here, we've got the beginning of a real entry */
ctab[ctab_free++] = to = from;
while (1) {
Index: buffindexed/buffindexed.c
===================================================================
RCS file: /upstream-repositories/inn-cvs.isc.org/inn/storage/buffindexed/buffindexed.c,v
retrieving revision 1.54
diff -u -r1.54 buffindexed.c
--- buffindexed/buffindexed.c 2001/01/05 04:09:15 1.54
+++ buffindexed/buffindexed.c 2001/02/12 07:11:58
@@ -371,10 +371,6 @@
return FALSE;
}
for (from = to = config; *from; ) {
- if (ctab_free == 0)
- ctab = NEW(char *, 1);
- else
- RENEW(ctab, char *, ctab_free+1);
if (*from == '#') { /* Comment line? */
while (*from && *from != '\n')
from++; /* Skip past it */
@@ -385,6 +381,10 @@
from++;
continue; /* Back to top of loop */
}
+ if (ctab_free == 0)
+ ctab = NEW(char *, 1);
+ else
+ RENEW(ctab, char *, ctab_free+1);
/* If we're here, we've got the beginning of a real entry */
ctab[ctab_free++] = to = from;
while (1) {
--
Alex Kiernan, Principal Engineer, Development, Thus PLC
More information about the inn-patches
mailing list