]> granicus.if.org Git - php/commitdiff
MFB: fix bug 37635 (argument to pcntl signal handler is trashed)
authorMichael Wallner <mike@php.net>
Tue, 30 May 2006 17:44:23 +0000 (17:44 +0000)
committerMichael Wallner <mike@php.net>
Tue, 30 May 2006 17:44:23 +0000 (17:44 +0000)
ext/pcntl/pcntl.c

index 1eda2316c4577770b5f7272ce0a608b5c37229b9..05e93a6bb94b152ec765be08b6796fa95bd3b0a7 100755 (executable)
@@ -693,16 +693,19 @@ void pcntl_tick_handler()
        PCNTL_G(head) = NULL; /* simple stores are atomic */
        
        /* Allocate */
-       MAKE_STD_ZVAL(param);
-       MAKE_STD_ZVAL(retval);
 
        while (queue) {
                if (zend_hash_index_find(&PCNTL_G(php_signal_table), queue->signo, (void **) &handle)==SUCCESS) {
+                       MAKE_STD_ZVAL(retval);
+                       MAKE_STD_ZVAL(param);
+                       ZVAL_NULL(retval);
                        ZVAL_LONG(param, queue->signo);
 
                        /* Call php signal handler - Note that we do not report errors, and we ignore the return value */
                        /* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */
                        call_user_function(EG(function_table), NULL, *handle, retval, 1, &param TSRMLS_CC);
+                       zval_ptr_dtor(&param);
+                       zval_ptr_dtor(&retval);
                }
 
                next = queue->next;
@@ -713,10 +716,6 @@ void pcntl_tick_handler()
 
        /* Re-enable queue */
        PCNTL_G(processing_signal_queue) = 0;
-
-       /* Clean up */
-       efree(param);
-       efree(retval);
 }