com php-src: Refactored the previous memleak fix: ext/fileinfo/libmagic/apprentice.c
| From: | Anatol Belski | Date: | Mon, 08 Apr 2013 12:32:37 +0000 |
| Subject: | com php-src: Refactored the previous memleak fix: ext/fileinfo/libmagic/apprentice.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-71884@lists.php.net to get a copy of this message | ||
Commit: f3ca1155d684d48bca13fcba856e84b0de652a88
Author: Anatol Belski <ab@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);
}