From 2c2c03ddbbe55123c81648a4eb152ea9de0a7bdd Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Fri, 13 Feb 2009 18:24:18 +0000 Subject: [PATCH] fix leak, from Robert G. --- src/funcs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; -- 2.50.1