Fixed leak in gdscript when creating empty WeakRef

Fixes #33150
This commit is contained in:
PouleyKetchoupp 2019-10-29 23:53:56 +01:00
parent b8daad9779
commit bcbe5b5850

View file

@ -589,7 +589,8 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
r_ret = wref; r_ret = wref;
} }
} else if (p_args[0]->get_type() == Variant::NIL) { } else if (p_args[0]->get_type() == Variant::NIL) {
r_ret = memnew(WeakRef); Ref<WeakRef> wref = memnew(WeakRef);
r_ret = wref;
} else { } else {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0; r_error.argument = 0;