[libsecret] test-collection: Fix string leaks
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsecret] test-collection: Fix string leaks
- Date: Mon, 19 Oct 2015 13:15:10 +0000 (UTC)
commit 91ee4c847d23bc221bc4ce80a7d95438eefd1223
Author: Christophe Fergeau <cfergeau redhat com>
Date: Sat Oct 17 23:08:36 2015 +0200
test-collection: Fix string leaks
This fixes:
==16832== 6 bytes in 1 blocks are definitely lost in loss record 8 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 0x36E56688AE: g_strdup (gstrfuncs.c:356)
==16832== by 0x4C2B242: secret_collection_get_label (secret-collection.c:1835)
==16832== by 0x40313D: test_create_sync (test-collection.c:305)
==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)
==16832==-
==16832== 6 bytes in 1 blocks are definitely lost in loss record 9 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 0x36E56688AE: g_strdup (gstrfuncs.c:356)
==16832== by 0x4C2B242: secret_collection_get_label (secret-collection.c:1835)
==16832== by 0x40337C: test_create_async (test-collection.c:333)
==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
libsecret/test-collection.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/libsecret/test-collection.c b/libsecret/test-collection.c
index 0cc9f4d..349935b 100644
--- a/libsecret/test-collection.c
+++ b/libsecret/test-collection.c
@@ -291,6 +291,7 @@ test_for_alias_load_async (Test *test,
result = NULL;
}
+#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)
@@ -304,7 +305,7 @@ test_create_sync (Test *test,
g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)),
"/org/freedesktop/secrets/collection"));
- g_assert_cmpstr (secret_collection_get_label (collection), ==, "Train");
+ g_assert_cmpstr_free (secret_collection_get_label (collection), ==, "Train");
g_assert (secret_collection_get_locked (collection) == FALSE);
g_object_unref (collection);
@@ -332,7 +333,7 @@ test_create_async (Test *test,
g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)),
"/org/freedesktop/secrets/collection"));
- g_assert_cmpstr (secret_collection_get_label (collection), ==, "Train");
+ g_assert_cmpstr_free (secret_collection_get_label (collection), ==, "Train");
g_assert (secret_collection_get_locked (collection) == FALSE);
g_object_unref (collection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]