}
} zend_end_try();
- /* 7.5 free last error information */
+ /* 7.5 free last error information and temp dir */
if (PG(last_error_message)) {
free(PG(last_error_message));
PG(last_error_message) = NULL;
free(PG(last_error_file));
PG(last_error_file) = NULL;
}
+ php_shutdown_temporary_directory();
/* 7. Shutdown scanner/executor/compiler and restore ini entries */
zend_deactivate(TSRMLS_C);
#endif
php_output_shutdown();
- php_shutdown_temporary_directory();
module_initialized = 0;
PHPAPI void php_shutdown_temporary_directory(void)
{
if (temporary_directory) {
- free(temporary_directory);
+ efree(temporary_directory);
temporary_directory = NULL;
}
}
if (sys_temp_dir) {
int len = strlen(sys_temp_dir);
if (len >= 2 && sys_temp_dir[len - 1] == DEFAULT_SLASH) {
- temporary_directory = zend_strndup(sys_temp_dir, len - 1);
+ temporary_directory = estrndup(sys_temp_dir, len - 1);
return temporary_directory;
} else if (len >= 1 && sys_temp_dir[len - 1] != DEFAULT_SLASH) {
- temporary_directory = zend_strndup(sys_temp_dir, len);
+ temporary_directory = estrndup(sys_temp_dir, len);
return temporary_directory;
}
}
DWORD len = GetTempPath(sizeof(sTemp),sTemp);
assert(0 < len); /* should *never* fail! */
if (sTemp[len - 1] == DEFAULT_SLASH) {
- temporary_directory = zend_strndup(sTemp, len - 1);
+ temporary_directory = estrndup(sTemp, len - 1);
} else {
- temporary_directory = zend_strndup(sTemp, len);
+ temporary_directory = estrndup(sTemp, len);
}
return temporary_directory;
}
int len = strlen(s);
if (s[len - 1] == DEFAULT_SLASH) {
- temporary_directory = zend_strndup(s, len - 1);
+ temporary_directory = estrndup(s, len - 1);
} else {
- temporary_directory = zend_strndup(s, len);
+ temporary_directory = estrndup(s, len);
}
return temporary_directory;
#ifdef P_tmpdir
/* Use the standard default temporary directory. */
if (P_tmpdir) {
- temporary_directory = strdup(P_tmpdir);
+ temporary_directory = estrdup(P_tmpdir);
return temporary_directory;
}
#endif
/* Shouldn't ever(!) end up here ... last ditch default. */
- temporary_directory = strdup("/tmp");
+ temporary_directory = estrndup("/tmp", sizeof("/tmp"));
return temporary_directory;
#endif
}