From 55ff6ffa9702f928e191912a0dea3245fc4c0a7b Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 21 Dec 2006 01:03:54 +0000 Subject: [PATCH] MFH fix leaks on errors --- ext/posix/posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/posix/posix.c b/ext/posix/posix.c index b3a552a6ef..4744284890 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -822,6 +822,7 @@ PHP_FUNCTION(posix_getgrnam) } if (!php_posix_group_to_array(g, return_value)) { + zval_dtor(return_value); php_error(E_WARNING, "%s() unable to convert posix group to array", get_active_function_name(TSRMLS_C)); RETURN_FALSE; @@ -853,6 +854,7 @@ PHP_FUNCTION(posix_getgrgid) } if (!php_posix_group_to_array(g, return_value)) { + zval_dtor(return_value); php_error(E_WARNING, "%s() unable to convert posix group struct to array", get_active_function_name(TSRMLS_C)); RETURN_FALSE; @@ -898,6 +900,7 @@ PHP_FUNCTION(posix_getpwnam) } if (!php_posix_passwd_to_array(pw, return_value)) { + zval_dtor(return_value); php_error(E_WARNING, "%s() unable to convert posix passwd struct to array", get_active_function_name(TSRMLS_C)); RETURN_FALSE; @@ -927,6 +930,7 @@ PHP_FUNCTION(posix_getpwuid) } if (!php_posix_passwd_to_array(pw, return_value)) { + zval_dtor(return_value); php_error(E_WARNING, "%s() unable to convert posix passwd struct to array", get_active_function_name(TSRMLS_C)); RETURN_FALSE; @@ -1046,8 +1050,10 @@ PHP_FUNCTION(posix_getrlimit) } for (l=limits; l->name; l++) { - if (posix_addlimit(l->limit, l->name, return_value TSRMLS_CC) == FAILURE) + if (posix_addlimit(l->limit, l->name, return_value TSRMLS_CC) == FAILURE) { + zval_dtor(return_value); RETURN_FALSE; + } } } /* }}} */ -- 2.50.1