summaryrefslogtreecommitdiff
path: root/ext/fileinfo/libmagic/apprentice.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fileinfo/libmagic/apprentice.c')
-rw-r--r--ext/fileinfo/libmagic/apprentice.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index 11920e6589..fd82564bff 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -493,12 +493,14 @@ apprentice_unmap(struct magic_map *map)
if (map == NULL)
return;
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) {
+ if (map->p == NULL) {
+ int j;
+ for (j = 0; j < MAGIC_SETS; j++) {
+ if (map->magic[j]) {
+ efree(map->magic[j]);
+ }
+ }
+ } else {
efree(map->p);
}
}