Subject: bin/2691: rdist leaks memory
To: None <gnats-bugs@NetBSD.ORG>
From: None <kashmir@umiacs.UMD.EDU>
List: netbsd-bugs
Date: 08/12/1996 19:02:00
>Number: 2691
>Category: bin
>Synopsis: rdist misses a call to regfree(), leaks memory
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 12 19:35:06 1996
>Last-Modified:
>Originator: Mike Grupenhoff
>Organization:
>Release: -release as of 8/12
>Environment:
System: NetBSD snarf.umiacs.umd.edu 1.2_ALPHA NetBSD 1.2_ALPHA (SNARF) #119: Wed Jul 24 18:05:08 EDT 1996 kashmir@snarf.umiacs.umd.edu:/usr/src/sys/arch/i386/compile/SNARF i386
>Description:
except() in docmd.c was recently converted over to use the posix
regcomp()/regexec() routines. However, it never calls regfree().
Bug noticed and fixed by Charles Amos <amos@umiacs.umd.edu>
>How-To-Repeat:
rdist with a rule that has many hosts and an except().
>Fix:
/usr/src/usr.bin/rdist/docmd.c:
--- docmd.c.old Mon Aug 12 18:54:12 1996
+++ docmd.c Mon Aug 12 18:56:05 1996
@@ -620,8 +620,11 @@
(void) regerror(err, &s, ebuf, sizeof(ebuf));
error("%s: %s\n", nl->n_name, ebuf);
}
- if (regexec(&s, file, 0, NULL, 0) == 0)
+ if (regexec(&s, file, 0, NULL, 0) == 0) {
+ regfree(&s);
return(1);
+ }
+ regfree(&s);
}
}
return(0);
>Audit-Trail:
>Unformatted: