]> granicus.if.org Git - php/commitdiff
fix memory leak at apprentice.c:1095
authorAnatol Belski <ab@php.net>
Mon, 8 Apr 2013 10:49:53 +0000 (12:49 +0200)
committerAnatol Belski <ab@php.net>
Mon, 8 Apr 2013 10:49:53 +0000 (12:49 +0200)
ext/fileinfo/libmagic/apprentice.c

index 8c729d13b9b9e1feba3288f3fafe4e42e3820bb2..06d28ad5c777af043641b72cde14ec4f638963e7 100644 (file)
@@ -495,6 +495,13 @@ apprentice_unmap(struct magic_map *map)
        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]);
+               }
+       }
        efree(map);
 }