From: Dmitry Stogov Date: Tue, 9 Jan 2007 16:27:17 +0000 (+0000) Subject: Close open files in case of failure (Amit) X-Git-Tag: php-5.2.1RC3~68 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5709b64739301c5beb1304d3bedd2c854f8241ee;p=php Close open files in case of failure (Amit) --- diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 3806efa768..73ecf1bd82 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -755,6 +755,13 @@ PHP_FUNCTION(proc_open) } if (FALSE == newprocok) { + /* clean up all the descriptors */ + for (i = 0; i < ndesc; i++) { + CloseHandle(descriptors[i].childend); + if (descriptors[i].parentend) { + CloseHandle(descriptors[i].parentend); + } + } php_error_docref(NULL TSRMLS_CC, E_WARNING, "CreateProcess failed"); goto exit_fail; }