]> granicus.if.org Git - php/commitdiff
Fixed leaks that occurs if the third parameter already contains a valid value.
authorMoriyoshi Koizumi <moriyoshi@php.net>
Sat, 12 Jul 2003 06:50:32 +0000 (06:50 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Sat, 12 Jul 2003 06:50:32 +0000 (06:50 +0000)
ext/standard/proc_open.c

index 15c3eac6075c8121c37db2793b20d115fad1d1cf..ce290865984306585554b25aeea51f9044a0db92 100644 (file)
@@ -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