diff options
author | Anatol Belski <ab@php.net> | 2013-04-08 14:32:37 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2013-04-08 14:32:37 +0200 |
commit | f3ca1155d684d48bca13fcba856e84b0de652a88 (patch) | |
tree | 7e27e15dd232a4f0d526720a20711f89591c7366 /ext/fileinfo/libmagic/apprentice.c | |
parent | 28e26b0fad184e337e4494da541bb5c1e8987291 (diff) | |
download | php-git-f3ca1155d684d48bca13fcba856e84b0de652a88.tar.gz |
Refactored the previous memleak fix
to avoid usage of a freed pointer. Thanks Laruence )
Diffstat (limited to 'ext/fileinfo/libmagic/apprentice.c')
-rw-r--r-- | ext/fileinfo/libmagic/apprentice.c | 6 |
1 files changed, 3 insertions, 3 deletions
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); } |