Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory errors in testlibrary and other test code #5691

Merged
merged 10 commits into from
Feb 15, 2024
Prev Previous commit
Next Next commit
testlibrary: Don't leak several installed references
Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv committed Feb 15, 2024
commit 8dd4358dc1374c48558724c88a35042c30b5848d
7 changes: 5 additions & 2 deletions tests/testlibrary.c
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ test_update_installed_ref_if_missing_runtime (void)
G_GNUC_END_IGNORE_DEPRECATIONS
g_assert_no_error (error);
g_assert_true (FLATPAK_IS_INSTALLED_REF (iref));
iref = NULL;
g_clear_object (&iref);

/* Install the Locale extension */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
Expand All @@ -1234,7 +1234,7 @@ test_update_installed_ref_if_missing_runtime (void)
G_GNUC_END_IGNORE_DEPRECATIONS
g_assert_no_error (error);
g_assert_true (FLATPAK_IS_INSTALLED_REF (iref));
iref = NULL;
g_clear_object (&iref);

updatable_refs = flatpak_installation_list_installed_refs_for_update (inst, NULL, &error);
g_assert_cmpint (updatable_refs->len, ==, 1);
Expand All @@ -1259,6 +1259,7 @@ test_update_installed_ref_if_missing_runtime (void)
iref = flatpak_installation_get_installed_ref (inst, FLATPAK_REF_KIND_RUNTIME, "org.test.Platform", NULL, NULL, NULL, &error);
g_assert_nonnull (iref);
g_assert_no_error (error);
g_clear_object (&iref);
}

static void
Expand Down Expand Up @@ -4486,12 +4487,14 @@ test_overrides (void)
G_GNUC_END_IGNORE_DEPRECATIONS
g_assert_no_error (error);
g_assert_nonnull (ref);
g_clear_object (&ref);

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
ref = flatpak_installation_install (inst, repo_name, FLATPAK_REF_KIND_RUNTIME, "org.test.Platform", NULL, "master", NULL, NULL, NULL, &error);
G_GNUC_END_IGNORE_DEPRECATIONS
g_assert_no_error (error);
g_assert_nonnull (ref);
g_clear_object (&ref);

{
TESTS_SCOPED_STDOUT_TO_STDERR;
Expand Down