com php-src: fix memory leak at apprentice.c:1095: ext/fileinfo/libmagic/apprentice.c
| From: | Anatol Belski | Date: | Mon, 08 Apr 2013 10:49:53 +0000 |
| Subject: | com php-src: fix memory leak at apprentice.c:1095: ext/fileinfo/libmagic/apprentice.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-71883@lists.php.net to get a copy of this message | ||
Commit: 28e26b0fad184e337e4494da541bb5c1e8987291
Author: Anatol Belski <ab@php.net> Mon, 8 Apr 2013 12:49:53 +0200
Parents: b0b81c0a37b33ee6b302c828831a2d1488994cb5
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=28e26b0fad184e337e4494da541bb5c1e8987291
Log:
fix memory leak at apprentice.c:1095
Changed paths:
M ext/fileinfo/libmagic/apprentice.c
Diff:
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index 8c729d1..06d28ad 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -495,6 +495,13 @@ apprentice_unmap(struct magic_map *map)
if (map->p != NULL && map->p != php_magic_database) {
efree(map->p);
}
+ if (map->p != php_magic_database) {
+ int j;
+ for (j = 0; j < MAGIC_SETS; j++) {
+ if (map->magic[j])
+ efree(map->magic[j]);
+ }
+ }
efree(map);
}