From: Anatol Belski Date: Mon, 8 Apr 2013 12:32:37 +0000 (+0200) Subject: Refactored the previous memleak fix X-Git-Tag: php-5.4.15RC1~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3ca1155d684d48bca13fcba856e84b0de652a88;p=php Refactored the previous memleak fix to avoid usage of a freed pointer. Thanks Laruence ) --- diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 06d28ad5c7..0620fc7f93 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -492,15 +492,15 @@ apprentice_unmap(struct magic_map *map) { if (map == NULL) return; - 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]); } + if (map->p != NULL) { + efree(map->p); + } } efree(map); }