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 2754cd1690567ee542bbb79e1a05366efd6131fb..644c9d98d4aa9b5a254ab16feb1347727128f108 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.233 2016/06/01 22:04:10 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.234 2016/06/13 12:02:06 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);