summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2021-04-13 10:14:29 +1200
committerOlly Betts <olly@survex.com>2021-04-13 10:14:29 +1200
commit93a288c85a8142643b907d3faff8f64303757136 (patch)
tree9035e2c92b50405a99a6b63226e0f7ef934bd64f /Source
parent60e7deda2c3ac70b097614eaafca6a4ba9910625 (diff)
downloadswig-93a288c85a8142643b907d3faff8f64303757136.tar.gz
Fix memory leak in SWIG tool
Diffstat (limited to 'Source')
-rw-r--r--Source/Modules/php.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx
index 7d31483bd..78c095ccf 100644
--- a/Source/Modules/php.cxx
+++ b/Source/Modules/php.cxx
@@ -1378,11 +1378,9 @@ public:
Replaceall(tm, "$target", ln);
Replaceall(tm, "$input", source);
if (paramType_valid) {
- String *param_value = NewStringEmpty();
- String *param_zval = NewStringEmpty();
- Printf(param_zval, "&%s", source);
- Printf(param_value, "SWIG_Z_FETCH_OBJ_P(%s)->ptr", param_zval);
+ String *param_value = NewStringf("SWIG_Z_FETCH_OBJ_P(&%s)->ptr", source);
Replaceall(tm, "$obj_value", param_value);
+ Delete(param_value);
}
Replaceall(tm, "$needNewFlow", paramType_valid ? (is_class_wrapped(paramType_class) ? "1" : "0") : "0");
String *temp_obj = NewStringEmpty();