summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-11-16 22:49:02 +0000
committerjoerg <joerg@FreeBSD.org>1996-11-16 22:49:02 +0000
commitddd4c56592409e81016f0d4519c190e81d13b43d (patch)
treeca41b18892e1305dfc1a7a3cbe59d57f5736792b /usr.sbin
parent7f32fc4e018bd5253c85acb022251eb99df755c3 (diff)
downloadFreeBSD-src-ddd4c56592409e81016f0d4519c190e81d13b43d.zip
FreeBSD-src-ddd4c56592409e81016f0d4519c190e81d13b43d.tar.gz
Initialize memory obtained by malloc().
Detected by: phkmalloc -AJ
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c
index 76c8333..76b2000 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.c
+++ b/usr.sbin/crunch/crunchgen/crunchgen.c
@@ -318,7 +318,10 @@ void add_prog(char *progname)
if(!strcmp(p2->name, progname)) return;
p2 = malloc(sizeof(prog_t));
- if(p2) p2->name = strdup(progname);
+ if(p2) {
+ memset(p2, 0, sizeof(prog_t));
+ p2->name = strdup(progname);
+ }
if(!p2 || !p2->name)
out_of_memory();
@@ -846,7 +849,10 @@ void add_string(strlst_t **listp, char *str)
if(!strcmp(p2->str, str)) return;
p2 = malloc(sizeof(strlst_t));
- if(p2) p2->str = strdup(str);
+ if(p2) {
+ memset(p2, 0, sizeof(strlst_t));
+ p2->str = strdup(str);
+ }
if(!p2 || !p2->str)
out_of_memory();
OpenPOWER on IntegriCloud