summaryrefslogtreecommitdiff
path: root/ext/fileinfo/libmagic/apprentice.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2013-04-08 14:32:37 +0200
committerAnatol Belski <ab@php.net>2013-04-08 14:32:37 +0200
commitf3ca1155d684d48bca13fcba856e84b0de652a88 (patch)
tree7e27e15dd232a4f0d526720a20711f89591c7366 /ext/fileinfo/libmagic/apprentice.c
parent28e26b0fad184e337e4494da541bb5c1e8987291 (diff)
downloadphp-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.c6
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);
}