test-collection: Fix GError leaks

This fixes (among others):
==16832== 95 (16 direct, 79 indirect) bytes in 1 blocks are definitely lost in loss record 927 of 1,184
==16832==    at 0x4A06C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16832==    by 0x36E564F679: g_malloc (gmem.c:97)
==16832==    by 0x36E5666CD2: g_slice_alloc (gslice.c:1007)
==16832==    by 0x36E563522B: g_error_new_valist (gerror.c:386)
==16832==    by 0x36E563560A: g_set_error (gerror.c:560)
==16832==    by 0x4C27FB4: secret_collection_initable_init (secret-collection.c:543)
==16832==    by 0x36E6E5D83E: g_initable_new_valist (ginitable.c:228)
==16832==    by 0x36E6E5D8F5: g_initable_new (ginitable.c:146)
==16832==    by 0x4C3E1E3: secret_collection_new_for_dbus_path_sync (secret-paths.c:158)
==16832==    by 0x404733: test_delete_sync (test-collection.c:623)
==16832==    by 0x36E566FB92: test_case_run (gtestutils.c:2124)
==16832==    by 0x36E566FB92: g_test_run_suite_internal (gtestutils.c:2185)
==16832==    by 0x36E566FD5A: g_test_run_suite_internal (gtestutils.c:2196)
==16832==    by 0x36E56700DA: g_test_run_suite (gtestutils.c:2249)
==16832==    by 0x36E5670110: g_test_run (gtestutils.c:1553)
==16832==    by 0x4C5A0EA: egg_tests_run_with_loop (egg-testing.c:167)
==16832==    by 0x4068B0: main (test-collection.c:1028)

https://bugzilla.gnome.org/show_bug.cgi?id=756766
This commit is contained in:
Christophe Fergeau 2015-10-17 23:07:53 +02:00
parent b6189a95e9
commit d416da7705

View File

@ -150,6 +150,7 @@ test_new_sync_noexist (Test *test,
SECRET_COLLECTION_NONE, NULL, &error);
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
g_assert (collection == NULL);
g_clear_error (&error);
}
static void
@ -170,6 +171,7 @@ test_new_async_noexist (Test *test,
collection = secret_collection_new_for_dbus_path_finish (result, &error);
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
g_assert (collection == NULL);
g_clear_error (&error);
g_object_unref (result);
}
@ -624,6 +626,7 @@ test_delete_sync (Test *test,
SECRET_COLLECTION_NONE, NULL, &error);
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
g_assert (collection == NULL);
g_clear_error (&error);
}
static void
@ -656,6 +659,7 @@ test_delete_async (Test *test,
SECRET_COLLECTION_NONE, NULL, &error);
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
g_assert (collection == NULL);
g_clear_error(&error);
}
static void