]> granicus.if.org Git - file/commitdiff
fix leak, from Robert G.
authorChristos Zoulas <christos@zoulas.com>
Fri, 13 Feb 2009 18:24:18 +0000 (18:24 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 13 Feb 2009 18:24:18 +0000 (18:24 +0000)
src/funcs.c

index af10688e3b9916ab31d8b97a454e07ca3ca9527d..b7318bdab871c0714f6ec8ecb46159e5b2f0cc58 100644 (file)
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.51 2008/11/07 18:57:28 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.52 2009/02/13 18:24:18 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -303,7 +303,10 @@ file_reset(struct magic_set *ms)
                file_error(ms, 0, "no magic files loaded");
                return -1;
        }
-       ms->o.buf = NULL;
+       if (ms->o.buf) {
+               free(ms->o.buf);
+               ms->o.buf = NULL;
+       }
        ms->event_flags &= ~EVENT_HAD_ERR;
        ms->error = -1;
        return 0;