jsonnet
jsonnet copied to clipboard
Memory leaks in //cpp/libjsonnet++.cc
I find a bug that causes memory leaking in //cpp/libjsonnet++.cc
.
In Line 97, the output char array jsonnet_output
has not been freed. To my understanding, we need a ::jsonnet_realloc(vm_, jsonnet_output, 0);
to free the memory before function returns.
The same problem in Line 113, 149, and 165.
Thanks for reporting. The C++ bindings are not very heavily exercised (I think most people use C bindings even from C++). We definitely should check it out and fix it, if it's an actual leak.
Also we might consider setting up some tests with valgrind.
I think this was fixed by #1013 (valgrind still reports no leaks when running libjsonnet++_test
on master now). Closing as complete.