com php-src: fix mem leak: ext/standard/image.c

From: Date: Fri, 02 Sep 2016 17:46:32 +0000
Subject: com php-src: fix mem leak: ext/standard/image.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94256@lists.php.net to get a copy of this message
Commit: 44e43a4738a45797457d6fe740bf33148a5e34c1 Author: Anatol Belski <ab@php.net> Fri, 2 Sep 2016 11:33:17 +0200 Parents: 8f110ee4dc0b262bac3909270abe4d2f8a95103c Branches: PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=44e43a4738a45797457d6fe740bf33148a5e34c1 Log: fix mem leak Changed paths: M ext/standard/image.c Diff: diff --git a/ext/standard/image.c b/ext/standard/image.c index f39c670..c5616d1 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -209,21 +209,27 @@ static struct gfxinfo *php_handle_swc(php_stream * stream) b = ecalloc(1, len + 1); - if (php_stream_seek(stream, 5, SEEK_CUR)) + if (php_stream_seek(stream, 5, SEEK_CUR)) { + efree(b); return NULL; + } - if (php_stream_read(stream, (char *) a, sizeof(a)) != sizeof(a)) + if (php_stream_read(stream, (char *) a, sizeof(a)) != sizeof(a)) { + efree(b); return NULL; + } if (uncompress(b, &len, a, sizeof(a)) != Z_OK) { /* failed to decompress the file, will try reading the rest of the file */ if (php_stream_seek(stream, 8, SEEK_SET)) { + efree(b); return NULL; } bufz = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0); if (!bufz) { + efree(b); return NULL; }

« previous php.cvs (#94256) next »