summaryrefslogtreecommitdiff
path: root/modules/gdnative/pluginscript/pluginscript_instance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdnative/pluginscript/pluginscript_instance.cpp')
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.cpp b/modules/gdnative/pluginscript/pluginscript_instance.cpp
index 52d112bc93..931ab0bfe4 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_instance.cpp
@@ -84,8 +84,9 @@ Variant PluginScriptInstance::call(const StringName &p_method, const Variant **p
godot_variant ret = _desc->call_method(
_data, (godot_string_name *)&p_method, (const godot_variant **)p_args,
p_argcount, (godot_variant_call_error *)&r_error);
- Variant *var_ret = (Variant *)&ret;
- return *var_ret;
+ Variant var_ret = *(Variant *)&ret;
+ godot_variant_destroy(&ret);
+ return var_ret;
}
#if 0 // TODO: Don't rely on default implementations provided by ScriptInstance ?