From: Christos Zoulas Date: Fri, 13 Feb 2009 18:24:18 +0000 (+0000) Subject: fix leak, from Robert G. X-Git-Tag: FILE5_05~241 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c2c03ddbbe55123c81648a4eb152ea9de0a7bdd;p=file fix leak, from Robert G. --- diff --git a/src/funcs.c b/src/funcs.c index af10688e..b7318bda 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -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;