summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/fileinfo/libmagic/softmagic.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c
index a2fec71974..a4b6627971 100644
--- a/ext/fileinfo/libmagic/softmagic.c
+++ b/ext/fileinfo/libmagic/softmagic.c
@@ -1733,10 +1733,18 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
ms->offset = soffset;
if (rv == 1) {
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
- file_printf(ms, F(m->desc, "%u"), offset) == -1)
+ file_printf(ms, m->desc, offset) == -1) {
+ if (rbuf) {
+ efree(rbuf);
+ }
return -1;
- if (file_printf(ms, "%s", rbuf) == -1)
+ }
+ if (file_printf(ms, "%s", rbuf) == -1) {
+ if (rbuf) {
+ efree(rbuf);
+ }
return -1;
+ }
}
if (rbuf) {
efree(rbuf);