testlibrary: Fix memory leaks
testlibrary: Fix memory leaks

(cherry picked from commit 7224809bc1e2584708b29ec1389cbcf1eeba1d3f)

flatpak/flatpak,flatpak/flatpak,flatpak/flatpak,flatpak/flatpak,flatpak/flatpak