Repository: godot
Issue: Memory leak when using `VisualScript.add_node`
Labels: bug,topic:visualscript

### Godot version

4.0.dev.custom_build. 87de2e7c4

### System information

Ubuntu 21.04 - Nvidia GTX 970, Gnome shell 3.38 X11

### Issue description

```
	var temp_variable37 = VisualScript.new()
	temp_variable37.add_node(-11, VisualScriptYield.new(), Vector2(-0.49272176623344, -0.87018686532974))
	get_tree().quit()
```
cause this memory leak
```
Indirect leak of 152 byte(s) in 1 object(s) allocated from:
    #0 0x7f822e9b3c47 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x5640d7382155 in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:75
    #2 0x5640d7382066 in operator new(unsigned long, char const*) core/os/memory.cpp:40
    #3 0x5640d8884e30 in HashMap<StringName, Object::SignalData, HashMapHasherDefault, HashMapComparatorDefault<StringName>, (unsigned char)3, (unsigned char)8>::create_element(StringName const&) core/templates/hash_map.h:195
    #4 0x5640d887e0a2 in HashMap<StringName, Object::SignalData, HashMapHasherDefault, HashMapComparatorDefault<StringName>, (unsigned char)3, (unsigned char)8>::operator[](StringName const&) core/templates/hash_map.h:436
    #5 0x5640d885af51 in Object::connect(StringName const&, Callable const&, Vector<Variant> const&, unsigned int) core/object/object.cpp:1330
    #6 0x5640c368d802 in VisualScript::add_node(int, Ref<VisualScriptNode> const&, Vector2 const&) modules/visual_script/visual_script.cpp:281
    #7 0x5640c37d15e1 in void call_with_variant_args_helper<__UnexistingClass, int, Ref<VisualScriptNode> const&, Vector2 const&, 0ul, 1ul, 2ul>(__UnexistingClass*, void (__UnexistingClass::*)(int, Ref<VisualScriptNode> const&, Vector2 const&), Variant const**, Callable::CallError&, IndexSequence<0ul, 1ul, 2ul>) core/variant/binder_common.h:222
    #8 0x5640c37b71dd in void call_with_variant_args_dv<__UnexistingClass, int, Ref<VisualScriptNode> const&, Vector2 const&>(__UnexistingClass*, void (__UnexistingClass::*)(int, Ref<VisualScriptNode> const&, Vector2 const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) core/variant/binder_common.h:369
    #9 0x5640c379dd7a in MethodBindT<int, Ref<VisualScriptNode> const&, Vector2 const&>::call(Object*, Variant const**, int, Callable::CallError&) core/object/method_bind.h:286
    #10 0x5640d8848f2f in Object::call(StringName const&, Variant const**, int, Callable::CallError&) core/object/object.cpp:832
    #11 0x5640d7f13f6b in Variant::call(StringName const&, Variant const**, int, Variant&, Callable::CallError&) core/variant/variant_call.cpp:1017
    #12 0x5640c80cb4ef in GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) modules/gdscript/gdscript_vm.cpp:1487
    #13 0x5640c7ba7bcb in GDScriptInstance::call(StringName const&, Variant const**, int, Callable::CallError&) modules/gdscript/gdscript.cpp:1501
    #14 0x5640cfcbaad8 in Node::_gdvirtual__process_call(double) scene/main/node.h:232
    #15 0x5640cfc32648 in Node::_notification(int) scene/main/node.cpp:54
    #16 0x5640c2b48023 in Node::_notificationv(int, bool) scene/main/node.h:48
    #17 0x5640c39f9d96 in CanvasItem::_notificationv(int, bool) scene/main/canvas_item.h:47
    #18 0x5640cf976066 in Node2D::_notificationv(int, bool) scene/2d/node_2d.h:37
    #19 0x5640d884933e in Object::notification(int, bool) core/object/object.cpp:841
    #20 0x5640cfd62b5f in SceneTree::_notify_group_pause(StringName const&, int) scene/main/scene_tree.cpp:851
    #21 0x5640cfd551f8 in SceneTree::process(double) scene/main/scene_tree.cpp:453
    #22 0x5640c226d143 in Main::iteration() main/main.cpp:2570
    #23 0x5640c210535c in OS_LinuxBSD::run() platform/linuxbsd/os_linuxbsd.cpp:342
    #24 0x5640c20f39f3 in main platform/linuxbsd/godot_linuxbsd.cpp:58
    #25 0x7f822d9e4564 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28564)
Indirect leak of 608 byte(s) in 1 object(s) allocated from:
    #0 0x7fc54ccf2c47 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x557d82b32155 in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:75
    #2 0x557d82b32066 in operator new(unsigned long, char const*) core/os/memory.cpp:40
    #3 0x557d6ee321f4 in Object* ClassDB::creator<VisualScript>() core/object/class_db.h:151
    #4 0x557d83f822d6 in ClassDB::instantiate(StringName const&) core/object/class_db.cpp:545
    #5 0x557d73321f4a in GDScriptNativeClass::instantiate() modules/gdscript/gdscript.cpp:87
    #6 0x557d73321932 in GDScriptNativeClass::_new() modules/gdscript/gdscript.cpp:75
    #7 0x557d734186c9 in void call_with_variant_args_ret_helper<__UnexistingClass, Variant>(__UnexistingClass*, Variant (__UnexistingClass::*)(), Variant const**, Variant&, Callable::CallError&, IndexSequence<>) core/variant/binder_common.h:648
    #8 0x557d73418125 in void call_with_variant_args_ret_dv<__UnexistingClass, Variant>(__UnexistingClass*, Variant (__UnexistingClass::*)(), Variant const**, int, Variant&, Callable::CallError&, Vector<Variant> const&) core/variant/binder_common.h:453
    #9 0x557d7341781d in MethodBindTR<Variant>::call(Object*, Variant const**, int, Callable::CallError&) core/object/method_bind.h:455
    #10 0x557d7387ddde in GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) modules/gdscript/gdscript_vm.cpp:1595
    #11 0x557d73357bcb in GDScriptInstance::call(StringName const&, Variant const**, int, Callable::CallError&) modules/gdscript/gdscript.cpp:1501
    #12 0x557d7b46aad8 in Node::_gdvirtual__process_call(double) scene/main/node.h:232
    #13 0x557d7b3e2648 in Node::_notification(int) scene/main/node.cpp:54
    #14 0x557d6e2f8023 in Node::_notificationv(int, bool) scene/main/node.h:48
    #15 0x557d6f1a9d96 in CanvasItem::_notificationv(int, bool) scene/main/canvas_item.h:47
    #16 0x557d7b126066 in Node2D::_notificationv(int, bool) scene/2d/node_2d.h:37
    #17 0x557d83ff933e in Object::notification(int, bool) core/object/object.cpp:841
    #18 0x557d7b512b5f in SceneTree::_notify_group_pause(StringName const&, int) scene/main/scene_tree.cpp:851
    #19 0x557d7b5051f8 in SceneTree::process(double) scene/main/scene_tree.cpp:453
    #20 0x557d6da1d143 in Main::iteration() main/main.cpp:2570
    #21 0x557d6d8b535c in OS_LinuxBSD::run() platform/linuxbsd/os_linuxbsd.cpp:342
    #22 0x557d6d8a39f3 in main platform/linuxbsd/godot_linuxbsd.cpp:58
    #23 0x7fc54bd23564 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28564)

```

### Steps to reproduce

Above

### Minimal reproduction project

_No response_