From: Ilia Alshanetsky Date: Thu, 28 Sep 2006 23:18:29 +0000 (+0000) Subject: MFB: Fixed a large leak inside _php_image_create_from() X-Git-Tag: RELEASE_1_0_0RC1~1514 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b46b3f7e6f43d260236cc127910a47144f95333;p=php MFB: Fixed a large leak inside _php_image_create_from() --- diff --git a/ext/gd/gd.c b/ext/gd/gd.c index c3920f506c..833afb07a7 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -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)) {