[libsecret] test-item: Fix string leaks
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsecret] test-item: Fix string leaks
- Date: Mon, 19 Oct 2015 13:14:39 +0000 (UTC)
commit 4a7de5a403ea79010304f878cf693a00faadf29b
Author: Christophe Fergeau <cfergeau redhat com>
Date: Sat Oct 17 22:13:02 2015 +0200
test-item: Fix string leaks
This fixes:
==16901== 7 bytes in 1 blocks are definitely lost in loss record 9 of 1,154
==16901== at 0x4A06C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16901== by 0x36E564F679: g_malloc (gmem.c:97)
==16901== by 0x36E56688AE: g_strdup (gstrfuncs.c:356)
==16901== by 0x4C3098F: secret_item_get_label (secret-item.c:1922)
==16901== by 0x402A65: test_create_sync (test-item.c:203)
==16901== by 0x36E566FB92: test_case_run (gtestutils.c:2124)
==16901== by 0x36E566FB92: g_test_run_suite_internal (gtestutils.c:2185)
==16901== by 0x36E566FD5A: g_test_run_suite_internal (gtestutils.c:2196)
==16901== by 0x36E56700DA: g_test_run_suite (gtestutils.c:2249)
==16901== by 0x36E5670110: g_test_run (gtestutils.c:1553)
==16901== by 0x4C5A0EA: egg_tests_run_with_loop (egg-testing.c:167)
==16901== by 0x406AAE: main (test-item.c:880)
==16901==-
==16901== 7 bytes in 1 blocks are definitely lost in loss record 10 of 1,154
==16901== at 0x4A06C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16901== by 0x36E564F679: g_malloc (gmem.c:97)
==16901== by 0x36E56688AE: g_strdup (gstrfuncs.c:356)
==16901== by 0x4C3098F: secret_item_get_label (secret-item.c:1922)
==16901== by 0x402DB6: test_create_async (test-item.c:249)
==16901== by 0x36E566FB92: test_case_run (gtestutils.c:2124)
==16901== by 0x36E566FB92: g_test_run_suite_internal (gtestutils.c:2185)
==16901== by 0x36E566FD5A: g_test_run_suite_internal (gtestutils.c:2196)
==16901== by 0x36E56700DA: g_test_run_suite (gtestutils.c:2249)
==16901== by 0x36E5670110: g_test_run (gtestutils.c:1553)
==16901== by 0x4C5A0EA: egg_tests_run_with_loop (egg-testing.c:167)
==16901== by 0x406AAE: main (test-item.c:880)
==16901==-
https://bugzilla.gnome.org/show_bug.cgi?id=756766
libsecret/test-item.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libsecret/test-item.c b/libsecret/test-item.c
index 2221d8b..52d86e6 100644
--- a/libsecret/test-item.c
+++ b/libsecret/test-item.c
@@ -170,6 +170,8 @@ test_new_async_noexist (Test *test,
g_object_unref (result);
}
+#define g_assert_cmpstr_free(str1, op, str2) G_STMT_START { char *str = str1; g_assert_cmpstr (str, op,
str2); g_free (str); } G_STMT_END
+
static void
test_create_sync (Test *test,
gconstpointer unused)
@@ -202,7 +204,7 @@ test_create_sync (Test *test,
secret_value_unref (value);
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path));
- g_assert_cmpstr (secret_item_get_label (item), ==, "Tunnel");
+ g_assert_cmpstr_free (secret_item_get_label (item), ==, "Tunnel");
g_assert (secret_item_get_locked (item) == FALSE);
g_object_unref (item);
@@ -248,7 +250,7 @@ test_create_async (Test *test,
g_object_add_weak_pointer (G_OBJECT (item), (gpointer *)&item);
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path));
- g_assert_cmpstr (secret_item_get_label (item), ==, "Tunnel");
+ g_assert_cmpstr_free (secret_item_get_label (item), ==, "Tunnel");
g_assert (secret_item_get_locked (item) == FALSE);
g_object_unref (item);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]