[PHP-DEV] [PATCH] fix memory leak in fpm_conf_set_array()

2010-12-27 Thread Cristian Rodríguez

Signed-off-by: Cristian Rodríguez cristian.rodrig...@opensuse.org
---
 sapi/fpm/fpm/fpm_conf.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index 5d6fe77..5bd7e7c 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -318,7 +318,7 @@ static char *fpm_conf_set_array(zval *key, zval *value, void **config, int conve
 
 	if (convert_to_bool) {
 		char *err = fpm_conf_set_boolean(value, subconf, 0);
-		if (err) return err;
+		if (err) { free(kv); return err;}
 		kv-value = strdup(b ? On : Off);
 	} else {
 		kv-value = strdup(Z_STRVAL_P(value));

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [PATCH] fix memory leak in fpm_conf_set_array()

2010-12-27 Thread Antony Dovgal
On 12/28/2010 01:50 AM, Cristian Rodríguez wrote:
-   if (err) return err;
+   if (err) { free(kv); return err;}

I believe the patch is a bit more complicated than that.
Here is new version: http://dev.daylessday.org/diff/fpm_leaks.diff
Could you test it please?

-- 
Wbr,
Antony Dovgal
---
http://pinba.org - realtime statistics for PHP

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php