From c5c4b2cafb32489c974850462a8c130a379f40c3 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Fri, 6 Jul 2018 19:39:13 +0200 Subject: [PATCH] Use native notification functions in test Since we'll allocate also some recursive elements with notification_create, we have to free the notification properly. --- test/notification.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/notification.c b/test/notification.c index de189ad..b2673ac 100644 --- a/test/notification.c +++ b/test/notification.c @@ -104,21 +104,25 @@ SUITE(suite_notification) load_settings("data/dunstrc.default"); struct notification *a = notification_create(); - a->appname = "Test"; - a->summary = "Summary"; - a->body = "Body"; - a->icon = "Icon"; + a->appname = g_strdup("Test"); + a->summary = g_strdup("Summary"); + a->body = g_strdup("Body"); + a->icon = g_strdup("Icon"); a->urgency = URG_NORM; struct notification *b = notification_create(); - memcpy(b, a, sizeof(*b)); + b->appname = g_strdup("Test"); + b->summary = g_strdup("Summary"); + b->body = g_strdup("Body"); + b->icon = g_strdup("Icon"); + b->urgency = URG_NORM; //2 equal notifications to be passed for duplicate checking, struct notification *n[2] = {a, b}; RUN_TEST1(test_notification_is_duplicate, (void*) n); - g_free(a); - g_free(b); + notification_free(a); + notification_free(b); RUN_TEST(test_notification_replace_single_field);