From cd52986a5c292f737e0309c77edff6d112dc3270 Mon Sep 17 00:00:00 2001 From: Moriyoshi Koizumi Date: Sat, 12 Jul 2003 06:50:32 +0000 Subject: [PATCH] Fixed leaks that occurs if the third parameter already contains a valid value. --- ext/standard/proc_open.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 15c3eac6075..ce290865984 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -470,7 +470,7 @@ PHP_FUNCTION(proc_open) struct php_process_handle *proc; int is_persistent = 0; /* TODO: ensure that persistent procs will work */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "saz/|s!a!", &command, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "saz|s!a!", &command, &command_len, &descriptorspec, &pipes, &cwd, &cwd_len, &environment) == FAILURE) { RETURN_FALSE; } @@ -737,6 +737,10 @@ PHP_FUNCTION(proc_open) proc->child = child; proc->env = env; + if (pipes != NULL) { + zval_dtor(pipes); + } + MAKE_STD_ZVAL(pipes); array_init(pipes); /* clean up all the child ends and then open streams on the parent