summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Walker <dave@mudsite.com>2016-07-07 15:35:09 -0600
committerDavid Walker <dave@mudsite.com>2016-07-07 21:33:01 -0600
commitcc16eff7ad89e61ce732329b7b3ddddcd418fc54 (patch)
tree60d15cf827b5afb8d28c06945d95273eed65ee3d
parentf64388e8c1686948d88401ae9871c87cb012b65f (diff)
downloadphp-git-cc16eff7ad89e61ce732329b7b3ddddcd418fc54.tar.gz
Fix memory leak
-rw-r--r--ext/pcntl/pcntl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index b8f75e5676..8c6105ac6f 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -560,6 +560,11 @@ PHP_RSHUTDOWN_FUNCTION(pcntl)
while (PCNTL_G(head)) {
sig = PCNTL_G(head);
PCNTL_G(head) = sig->next;
+#ifdef HAVE_STRUCT_SIGINFO_T
+ if (sig->siginfo) {
+ zend_array_destroy(sig->siginfo);
+ }
+#endif
efree(sig);
}
while (PCNTL_G(spares)) {
@@ -1375,10 +1380,10 @@ static void pcntl_signal_handler(int signo)
#ifdef HAVE_STRUCT_SIGINFO_T
zval user_siginfo;
- ZVAL_NEW_ARR(&user_siginfo);
array_init(&user_siginfo);
pcntl_siginfo_to_zval(signo, siginfo, &user_siginfo);
- psig->siginfo = Z_ARRVAL(user_siginfo);
+ psig->siginfo = zend_array_dup(Z_ARRVAL(user_siginfo));
+ zval_ptr_dtor(&user_siginfo);
#endif
/* the head check is important, as the tick handler cannot atomically clear both