From 0185b6114f9171d47e4a7524acbeb082054a8290 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 14 Sep 2017 09:32:16 +1200 Subject: [PATCH] Fix memory leaks in SWIGTYPE typemaps The "out" and "directorin" typemaps allocate a new object, but weren't specifying that this object should be owned. --- Lib/php/php.swg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/php/php.swg b/Lib/php/php.swg index 5172cddef..b06a6a563 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -438,19 +438,19 @@ #ifdef __cplusplus { $&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1); - SWIG_SetZval(return_value, $needNewFlow, $owner, (void *)resultobj, $&1_descriptor, $zend_obj); + SWIG_SetZval(return_value, $needNewFlow, 1, (void *)resultobj, $&1_descriptor, $zend_obj); } #else { $&1_ltype resultobj = ($&1_ltype) emalloc(sizeof($1_type)); memcpy(resultobj, &$1, sizeof($1_type)); - SWIG_SetZval(return_value, $needNewFlow, $owner, (void *)resultobj, $&1_descriptor, $zend_obj); + SWIG_SetZval(return_value, $needNewFlow, 1, (void *)resultobj, $&1_descriptor, $zend_obj); } #endif %typemap(directorin) SWIGTYPE %{ - SWIG_SetZval($input, $needNewFlow, $owner, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, $zend_obj); + SWIG_SetZval($input, $needNewFlow, 1, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, $zend_obj); %} %typemap(out) void "";