]> granicus.if.org Git - file/commitdiff
fix memory leak on error (delphij)
authorChristos Zoulas <christos@zoulas.com>
Mon, 13 Jun 2016 12:02:06 +0000 (12:02 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 13 Jun 2016 12:02:06 +0000 (12:02 +0000)
src/softmagic.c

index 1ccfa571bdc6f9c7982a64a8a61d2cf80f159185..4d52fe6187e2273077c2083c5764619f8a623547 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.232 2016/06/01 22:01:15 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.233 2016/06/01 22:04:10 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -2080,6 +2080,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
                        if (slen != 0) {
                            copy = malloc(slen);
                            if (copy == NULL)  {
+                               file_regfree(&rx);
                                file_error(ms, errno,
                                    "can't allocate %" SIZE_T_FORMAT "u bytes",
                                    slen);