From c8ce9c00805be16d660057079a665114507409df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Tue, 8 May 2018 21:23:59 +0200 Subject: [PATCH] Fix Variant leak in call_native (cherry picked from commit 474eda9e30cd86ff93ebf317df2e904b770a8851) --- modules/gdnative/gdnative.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 42c3028f2cd..1fa0f7f5c16 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -306,7 +306,9 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced godot_variant result = E->get()(procedure_handle, (godot_array *)&p_arguments); - return *(Variant *)&result; + Variant res = *(Variant *)&result; + godot_variant_destroy(&result); + return res; } Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle, bool p_optional) {