From bcbe5b58507fb9534507b570653e32357182ab52 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Tue, 29 Oct 2019 23:53:56 +0100 Subject: [PATCH] Fixed leak in gdscript when creating empty WeakRef Fixes #33150 --- modules/gdscript/gdscript_functions.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index d9535d0f1f0..c4c7ba5ef79 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -589,7 +589,8 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_ret = wref; } } else if (p_args[0]->get_type() == Variant::NIL) { - r_ret = memnew(WeakRef); + Ref wref = memnew(WeakRef); + r_ret = wref; } else { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0;