diff options
Diffstat (limited to 'ext/fileinfo/libmagic/apprentice.c')
-rw-r--r-- | ext/fileinfo/libmagic/apprentice.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 4196e17afa..ce747378aa 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -499,12 +499,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); } } |