Godot version
4.1.1
godot-cpp version
4.1
System information
Fedora Silverblue 38
Issue description

This function results in a memory leak.
Recreating this function line by line in GDScript doesn't result in memory leak.
I've tried to return Dictionary as is:

Which works fine.
Callable and callv() are affected too.
Steps to reproduce
N/A
Minimal reproduction project
gdextension-memory-leak-main.zip
You can also view it here: https://github.com/Lasuch69/gdextension-memory-leak
Godot version
4.1.1
godot-cpp version
4.1
System information
Fedora Silverblue 38
Issue description
This function results in a memory leak.
Recreating this function line by line in GDScript doesn't result in memory leak.
I've tried to return Dictionary as is:

Which works fine.
Callable and
callv()are affected too.Steps to reproduce
N/A
Minimal reproduction project
gdextension-memory-leak-main.zip
You can also view it here: https://github.com/Lasuch69/gdextension-memory-leak