From: Ilia Alshanetsky Date: Tue, 11 Jan 2011 12:57:19 +0000 (+0000) Subject: Added missing success check around chmod() for windows during temp file creation X-Git-Tag: php-5.4.0alpha1~191^2~387 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d5af830385ccbf1000694ecdb6a5dcd63513a9f4;p=php Added missing success check around chmod() for windows during temp file creation --- diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index a8ea24d1e1..458f2bf405 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -149,7 +149,11 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char ** if (GetTempFileName(new_state.cwd, pfx, 0, opened_path)) { /* Some versions of windows set the temp file to be read-only, * which means that opening it will fail... */ - VCWD_CHMOD(opened_path, 0600); + if (VCWD_CHMOD(opened_path, 0600)) { + efree(opened_path); + free(new_state.cwd); + return -1; + } fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600); }