From: Ilia Alshanetsky Date: Tue, 2 Nov 2004 16:42:13 +0000 (+0000) Subject: MFH: Fixed bug #30658 (Ensure that temporary files created by GD are removed). X-Git-Tag: php-4.3.10RC1~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21c8eb93ba8a8050e11ec1317ffeda782562ddf7;p=php MFH: Fixed bug #30658 (Ensure that temporary files created by GD are removed). --- diff --git a/NEWS b/NEWS index c52eaf4ce9..7be83609a7 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ PHP 4 NEWS - Fixed a bug in addslashes() handling of the '\0' character. (Ilia) - Backported Marcus' foreach() speedup patch from PHP 5.x. (Derick) - Fixed potential problems with unserializing invalid serialize data. (Marcus) +- Fixed bug #30658 (Ensure that temporary files created by GD are removed). + (Ilia) - Fixed bug #30613 (Prevent infinite recursion in url redirection). (Ilia) - Fixed bug #30475 (curl_getinfo() may crash in some situations). (Ilia) - Fixed bug #30442 (segfault when parsing ?getvariable[][ ). (Tony) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 803c0124d5..efe7eee843 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1663,8 +1663,9 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char int b; FILE *tmp; char buf[4096]; + char *path; - tmp = php_open_temporary_file("", "", NULL TSRMLS_CC); + tmp = php_open_temporary_file("", "", &path TSRMLS_CC); if (tmp == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open temporary file"); RETURN_FALSE; @@ -1717,7 +1718,8 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } fclose(tmp); - /* the temporary file is automatically deleted */ + VCWD_UNLINK((const char *)path); /* make sure that the temporary file is removed */ + efree(path); } RETURN_TRUE; }