]> granicus.if.org Git - php/commitdiff
MFB: Fixed bug #30658 (Ensure that temporary files created by GD are removed).
authorIlia Alshanetsky <iliaa@php.net>
Tue, 2 Nov 2004 16:41:41 +0000 (16:41 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 2 Nov 2004 16:41:41 +0000 (16:41 +0000)
ext/gd/gd.c

index e716f9079a5b8883fb288f41abb67240670a4789..1a00e92a17ec816285b86404b65939fd2d4edec1 100644 (file)
@@ -1767,8 +1767,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;
@@ -1823,7 +1824,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;
 }