]> granicus.if.org Git - file/commitdiff
make sure that all of magic_set is initialized.
authorChristos Zoulas <christos@zoulas.com>
Mon, 26 Mar 2007 17:59:49 +0000 (17:59 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 26 Mar 2007 17:59:49 +0000 (17:59 +0000)
ChangeLog
src/magic.c

index 4dcfe85047923ac24afd3a2988be2d399f7f1d7c..a23fdb29f8d75c4dbc681825fb43ed50eaf0d818 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
 
+2007-03-26 13:58 Christos Zoulas <christos@zoulas.com>
+
+       * make sure that all of struct magic_set is initialized appropriately
+         (Brett)
+
 2007-03-25 17:44 Christos Zoulas <christos@zoulas.com>
 
        * reset left bytes in the buffer (Dmitry V. Levin)
index 4de4ec7ecd26f85204fa1501327e5a3ab3f1bbf3..1449a0217a620606e50ac88fcd469ca5a7083186 100644 (file)
@@ -63,7 +63,7 @@
 #include "patchlevel.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: magic.c,v 1.39 2007/02/05 16:46:40 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.40 2007/03/01 22:14:55 christos Exp $")
 #endif /* lint */
 
 #ifdef __EMX__
@@ -86,7 +86,7 @@ magic_open(int flags)
 {
        struct magic_set *ms;
 
-       if ((ms = malloc(sizeof(struct magic_set))) == NULL)
+       if ((ms = calloc((size_t)1, sizeof(struct magic_set))) == NULL)
                return NULL;
 
        if (magic_setflags(ms, flags) == -1) {
@@ -109,6 +109,8 @@ magic_open(int flags)
        ms->haderr = 0;
        ms->error = -1;
        ms->mlist = NULL;
+       ms->file = "unknown";
+       ms->line = 0;
        return ms;
 free3:
        free(ms->o.pbuf);