From: Christos Zoulas Date: Thu, 16 Jun 2016 11:37:55 +0000 (+0000) Subject: Fix memory leak (Giovanni Bechis) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7560197380a3ff3994c2e6a93dc42495af67eca9;p=file Fix memory leak (Giovanni Bechis) --- diff --git a/src/ascmagic.c b/src/ascmagic.c index baa95aba..199ef9c8 100644 --- a/src/ascmagic.c +++ b/src/ascmagic.c @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: ascmagic.c,v 1.95 2016/05/03 16:10:37 christos Exp $") +FILE_RCSID("@(#)$File: ascmagic.c,v 1.96 2016/06/16 11:37:55 christos Exp $") #endif /* lint */ #include "magic.h" @@ -144,8 +144,10 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf, (size_t)(utf8_end - utf8_buf), NULL, NULL, TEXTTEST, text)) == 0) rv = -1; - if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) - return rv == -1 ? 0 : 1; + if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) { + rv == -1 ? 0 : 1; + goto done; + } } if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) return 0;