]> granicus.if.org Git - file/commitdiff
Fix memory leak (Giovanni Bechis)
authorChristos Zoulas <christos@zoulas.com>
Thu, 16 Jun 2016 11:37:55 +0000 (11:37 +0000)
committerChristos Zoulas <christos@zoulas.com>
Thu, 16 Jun 2016 11:37:55 +0000 (11:37 +0000)
src/ascmagic.c

index baa95aba2df52298451bbad556e5d5c30da11b4b..199ef9c85051ba1f680ae506c63600632f11ed01 100644 (file)
@@ -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;