tests: Fix two small leaks in the actions test

These are known leaks, as they were being done in tests which were
checking precondition failures.

However, since we know what happens when the failures occur, we can
still free the input data reliably, so do that.

This improves the valgrind output for `actions` to show zero definite
leaks.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2021-11-16 14:03:36 +00:00
parent c8fa295f6a
commit 4eafbaba94

View File

@ -275,10 +275,12 @@ test_stateful (void)
if (g_test_undefined ())
{
GVariant *new_state = g_variant_ref_sink (g_variant_new_int32 (123));
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*assertion*g_variant_is_of_type*failed*");
g_simple_action_set_state (action, g_variant_new_int32 (123));
g_simple_action_set_state (action, new_state);
g_test_assert_expected_messages ();
g_variant_unref (new_state);
}
g_simple_action_set_state (action, g_variant_new_string ("hello"));
@ -292,10 +294,12 @@ test_stateful (void)
if (g_test_undefined ())
{
GVariant *new_state = g_variant_ref_sink (g_variant_new_int32 (123));
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*assertion*!= NULL*failed*");
g_simple_action_set_state (action, g_variant_new_int32 (123));
g_simple_action_set_state (action, new_state);
g_test_assert_expected_messages ();
g_variant_unref (new_state);
}
g_object_unref (action);