php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch fileinfo-mem.patch for Filesystem function related Bug #66987

Patch version 2014-03-31 14:33 UTC

Return to Bug #66987 | Download this patch
Patch Revisions:

Developer: remi@php.net

--- /work/php/php-5.4.26/ext/fileinfo/libmagic/apprentice.c	2014-03-05 09:07:14.000000000 +0100
+++ ext/fileinfo/libmagic/apprentice.c	2014-03-31 16:31:03.095436097 +0200
@@ -493,12 +493,14 @@
 	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);
 		}
 	}
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 12:01:25 2019 UTC