]> granicus.if.org Git - file/commitdiff
initialize the buffers.
authorChristos Zoulas <christos@zoulas.com>
Fri, 20 Oct 2006 21:04:15 +0000 (21:04 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 20 Oct 2006 21:04:15 +0000 (21:04 +0000)
src/ascmagic.c

index 43d467cd3e2297dd4d1bddda8bb2626ade3cfbd0..81525c893be24f6df0289f8ef99f93df8a1d5290 100644 (file)
@@ -49,7 +49,7 @@
 #include "names.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$Id: ascmagic.c,v 1.45 2006/03/12 22:09:33 christos Exp $")
+FILE_RCSID("@(#)$Id: ascmagic.c,v 1.46 2006/10/20 21:04:15 christos Exp $")
 #endif /* lint */
 
 typedef unsigned long unichar;
@@ -102,9 +102,9 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
        while (nbytes > 1 && buf[nbytes - 1] == '\0')
                nbytes--;
 
-       if ((nbuf = malloc((nbytes + 1) * sizeof(nbuf[0]))) == NULL)
+       if ((nbuf = calloc(1, (nbytes + 1) * sizeof(nbuf[0]))) == NULL)
                goto done;
-       if ((ubuf = malloc((nbytes + 1) * sizeof(ubuf[0]))) == NULL)
+       if ((ubuf = calloc(1, (nbytes + 1) * sizeof(ubuf[0]))) == NULL)
                goto done;
 
        /*