]> granicus.if.org Git - php/commitdiff
improve fix
authorAnatol Belski <ab@php.net>
Fri, 2 Sep 2016 21:33:43 +0000 (23:33 +0200)
committerAnatol Belski <ab@php.net>
Fri, 2 Sep 2016 21:33:43 +0000 (23:33 +0200)
ext/standard/image.c

index c5616d111955380925736620255d8fda4aca2a44..480246ab9768c73efb6e1dad3c69c8bf0f3e3eac 100644 (file)
@@ -207,18 +207,16 @@ static struct gfxinfo *php_handle_swc(php_stream * stream)
        unsigned char *b, *buf = NULL;
        zend_string *bufz;
 
-       b = ecalloc(1, len + 1);
-
        if (php_stream_seek(stream, 5, SEEK_CUR)) {
-               efree(b);
                return NULL;
        }
 
        if (php_stream_read(stream, (char *) a, sizeof(a)) != sizeof(a)) {
-               efree(b);
                return NULL;
        }
 
+       b = ecalloc(1, len + 1);
+
        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)) {