]> granicus.if.org Git - php/commitdiff
MFB: Fixed a large leak inside _php_image_create_from()
authorIlia Alshanetsky <iliaa@php.net>
Thu, 28 Sep 2006 23:18:29 +0000 (23:18 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 28 Sep 2006 23:18:29 +0000 (23:18 +0000)
ext/gd/gd.c

index c3920f506ccb36c45532fef61cb4666cffb59d4f..833afb07a7b51f0b9ba9caebba03588c4cc2003e 100644 (file)
@@ -2212,6 +2212,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
 
                io_ctx = gdNewDynamicCtxEx(buff_size, buff, 0);
                if (!io_ctx) {
+                       pefree(buff, 1);
                        php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot allocate GD IO context");
                        goto out_err;
                }
@@ -2222,6 +2223,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
                        im = (*ioctx_func_p)(io_ctx);
                }
                io_ctx->gd_free(io_ctx);
+               pefree(buff, 1);
        } else {
                /* try and force the stream to be FILE* */
                if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_TRY_HARD, (void **) &fp, REPORT_ERRORS)) {