ID:               44446
 User updated by:  manuel at mausz dot at
 Reported By:      manuel at mausz dot at
 Status:           Open
 Bug Type:         *General Issues
 Operating System: Linux + Windows
 PHP Version:      5.2.6RC2
 New Comment:

That's the correct patch:

--- php-5.2.5/ext/standard/exec.c.orig  2008-03-16 17:15:28.000000000
+0100
+++ php-5.2.5/ext/standard/exec.c       2008-03-16 17:16:26.000000000
+0100
@@ -87,7 +87,7 @@
                efree(d);
                d = cmd_p;
        } else {
-               cmd_p = cmd;
+               cmd_p = estrdup(cmd);
        }

 #if PHP_SIGCHILD
@@ -99,6 +99,7 @@
 #else
        fp = VCWD_POPEN(cmd_p, "r");
 #endif
+       efree(cmd_p);
        if (!fp) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to
fork [%s]", cmd);
                goto err;


Previous Comments:
------------------------------------------------------------------------

[2008-03-16 15:59:13] manuel at mausz dot at

Description:
------------
There's a memory leak in php_exec. The escaped command never gets
freed.

--- ./ext/standard/exec.c.orig  2008-03-16 16:52:08.000000000 +0100
+++ ./ext/standard/exec.c       2008-03-16 16:51:54.000000000 +0100
@@ -116,6 +116,7 @@
 #else
        fp = VCWD_POPEN(cmd_p, "r");
 #endif
+       efree(cmd_p);
        if (!fp) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to
fork [%s]", cmd);
                goto err;




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44446&edit=1

Reply via email to