summaryrefslogtreecommitdiff
path: root/ext/standard/image.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-09-02 11:33:17 +0200
committerAnatol Belski <ab@php.net>2016-09-02 19:46:32 +0200
commit44e43a4738a45797457d6fe740bf33148a5e34c1 (patch)
tree47e5551de00c132bf89b4b4649095ea90170f527 /ext/standard/image.c
parent8f110ee4dc0b262bac3909270abe4d2f8a95103c (diff)
downloadphp-git-44e43a4738a45797457d6fe740bf33148a5e34c1.tar.gz
fix mem leak
Diffstat (limited to 'ext/standard/image.c')
-rw-r--r--ext/standard/image.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/standard/image.c b/ext/standard/image.c
index f39c670979..c5616d1119 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;
}