Commit:    f3ca1155d684d48bca13fcba856e84b0de652a88
Author:    Anatol Belski <a...@php.net>         Mon, 8 Apr 2013 14:32:37 +0200
Parents:   28e26b0fad184e337e4494da541bb5c1e8987291
Branches:  PHP-5.4 PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=f3ca1155d684d48bca13fcba856e84b0de652a88

Log:
Refactored the previous memleak fix

to avoid usage of a freed pointer. Thanks Laruence )

Changed paths:
  M  ext/fileinfo/libmagic/apprentice.c


Diff:
diff --git a/ext/fileinfo/libmagic/apprentice.c 
b/ext/fileinfo/libmagic/apprentice.c
index 06d28ad..0620fc7 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);
 }


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to