From: Felipe Pena Date: Tue, 22 Nov 2011 15:12:44 +0000 (+0000) Subject: - Fix the fix X-Git-Tag: php-5.3.9RC2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=72ad61733ae4f293e0aa1f2db426b84741827d01;p=php - Fix the fix --- diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index ce76881c3a..6844bf5d39 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -2070,11 +2070,11 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, } mm = emalloc((size_t)st.sb.st_size); + ret = 1; if (php_stream_read(stream, mm, (size_t)st.sb.st_size) != (size_t)st.sb.st_size) { file_badread(ms); goto error1; } - ret = 1; php_stream_close(stream); stream = NULL; @@ -2137,7 +2137,7 @@ error1: php_stream_close(stream); } - if (mm) { + if (mm && ret == 1) { efree(mm); } else { *magicp = NULL;