From: Stefan Esser Date: Tue, 19 Sep 2006 11:34:19 +0000 (+0000) Subject: Delete empty temporary files if file upload hook forbids the upload X-Git-Tag: php-5.2.0RC5~129 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e8fc23095adb09a68a8c70bfd8e65e4e359d5c2;p=php Delete empty temporary files if file upload hook forbids the upload --- diff --git a/main/rfc1867.c b/main/rfc1867.c index 699b0cfda0..778b7455fb 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -1033,6 +1033,14 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) event_file_start.filename = &filename; if (php_rfc1867_callback(MULTIPART_EVENT_FILE_START, &event_file_start, &event_extra_data TSRMLS_CC) == FAILURE) { skip_upload = 1; + if (temp_filename) { + if (cancel_upload != UPLOAD_ERROR_E) { /* file creation failed */ + close(fd); + unlink(temp_filename); + } + efree(temp_filename); + } + temp_filename=""; } }