submodule: Fix memory leaks
tests: Fix memory leak