--- embedaddon/php/ext/fileinfo/libmagic/apprentice.c 2013/07/22 01:31:50 1.1.1.3 +++ embedaddon/php/ext/fileinfo/libmagic/apprentice.c 2014/06/15 20:03:48 1.1.1.4 @@ -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); } }