Fix memory errors in testlibrary and other test code #5691
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continuation of #5690, fixing bugs in the test itself. Detected by running tests compiled with AddressSanitizer.
This fixes testlibrary, plus a few issues in other tests that I found before reducing the scope of what I was trying to just testlibrary.
After this has been reviewed I'm intending to continue to clean up AddressSanitizer issues as time permits, but repeatedly running the tests under AddressSanitizer is rather time-consuming, so I'd prefer to land this a piece at a time.
tests: Fix a double-free when exercising argument parsing
g_option_context_add_group() takes ownership of the group that it's
given, so we can't also free it.
Fixes: fab0f8e "test-context: Exercise some corner cases for merging filesystems"
testlibrary: Don't leak transactions
testlibrary: Don't leak several installed references
testlibrary: Don't leak FlatpakInstance
testlibrary: Don't leak icon data
testlibrary: Don't leak an array of related refs
testlibrary: Don't leak strings retrieved from remote
All of these getters are (transfer full) (but note that
flatpak_remote_get_name() isn't).
test_list_remote_related_refs: Don't leak list of subpaths
testlibrary: Don't leak list of subpaths
flatpak_deploy_data_get_subpaths() returns a new array (of unowned
strings) and flatpak_dir_new_deploy_data() doesn't take ownership.
httpcache: Free the GError before exiting