From 5f5a8f2d4a097474e0b4f2c94cc8d457f873e1b1 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Mon, 24 Jan 2022 13:32:22 +1300 Subject: [PATCH] [php] Initialise zval in directorin typemaps SWIG_SetPointerZval() requires the zval structure passed to be initialised (so it can handle the constructor case where the zval is already initialised as a PHP object. I couldn't think of a suitable regression test for this, but it fixes 2 issues detected by running director_basic under valgrind. --- Lib/php/php.swg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/php/php.swg b/Lib/php/php.swg index 1120f226e..981e4679b 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -419,6 +419,7 @@ SWIGTYPE &, SWIGTYPE && %{ + ZVAL_UNDEF($input); SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, $owner); %} @@ -460,6 +461,7 @@ %typemap(directorin) SWIGTYPE %{ + ZVAL_UNDEF($input); SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1); %}