[PATCH] fix memleak in libmagic in file 4.26
Robert G
file-libmagic at uukgoblin.net
Wed Jan 7 13:29:03 EET 2009
libmagic is leaking memory if someone calls magic_buffer() (magic_file()
will probably cause it too) multiple times with one magic_set cookie.
This small patch should fix it.
--
Robert G
-------------- next part --------------
diff --git a/src/funcs.c b/src/funcs.c
index af98605..280c715 100644
--- a/src/funcs.c
+++ b/src/funcs.c
@@ -235,6 +235,7 @@ file_reset(struct magic_set *ms)
file_error(ms, 0, "no magic files loaded");
return -1;
}
+ free(ms->o.buf);
ms->o.buf = NULL;
ms->haderr = 0;
ms->error = -1;
More information about the File
mailing list