mirror of
https://github.com/php/php-src.git
synced 2024-11-29 04:46:07 +08:00
MFH: Fixed fd leak (the origin commit can not be cherry-picked)
This commit is contained in:
parent
86732b4ea0
commit
de7a6b1232
@ -773,6 +773,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm)
|
||||
if (writev(fd, vec, 3) != (ssize_t)(sizeof(info) + script->size + info.str_size)) {
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "opcache cannot write to file '%s'\n", filename);
|
||||
zend_string_release((zend_string*)ZCG(mem));
|
||||
close(fd);
|
||||
efree(mem);
|
||||
unlink(filename);
|
||||
efree(filename);
|
||||
@ -786,6 +787,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm)
|
||||
) {
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "opcache cannot write to file '%s'\n", filename);
|
||||
zend_string_release((zend_string*)ZCG(mem));
|
||||
close(fd);
|
||||
efree(mem);
|
||||
unlink(filename);
|
||||
efree(filename);
|
||||
|
@ -757,7 +757,7 @@ int fcgi_listen(const char *path, int backlog)
|
||||
#endif
|
||||
bind(listen_socket, (struct sockaddr *) &sa, sock_len) < 0 ||
|
||||
listen(listen_socket, backlog) < 0) {
|
||||
|
||||
close(listen_socket);
|
||||
fcgi_log(FCGI_ERROR, "Cannot bind/listen socket - [%d] %s.\n",errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
@ -224,8 +224,10 @@ char** save_ps_args(int argc, char** argv)
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
new_argv[i] = strdup(argv[i]);
|
||||
if (!new_argv[i])
|
||||
if (!new_argv[i]) {
|
||||
free(new_argv);
|
||||
goto clobber_error;
|
||||
}
|
||||
}
|
||||
new_argv[argc] = NULL;
|
||||
|
||||
|
@ -1439,6 +1439,7 @@ phpdbg_main:
|
||||
case 'i': { /* set init file */
|
||||
if (init_file) {
|
||||
free(init_file);
|
||||
init_file = NULL;
|
||||
}
|
||||
|
||||
init_file_len = strlen(php_optarg);
|
||||
@ -1792,7 +1793,9 @@ phpdbg_main:
|
||||
/* initialize from file */
|
||||
PHPDBG_G(flags) |= PHPDBG_IS_INITIALIZING;
|
||||
zend_try {
|
||||
phpdbg_init(init_file, init_file_len, init_file_default);
|
||||
if (init_file) {
|
||||
phpdbg_init(init_file, init_file_len, init_file_default);
|
||||
}
|
||||
if (bp_tmp) {
|
||||
PHPDBG_G(flags) |= PHPDBG_DISCARD_OUTPUT;
|
||||
phpdbg_string_init(bp_tmp);
|
||||
|
Loading…
Reference in New Issue
Block a user