From e1461bcfd3af789c69d83919b52f364a0ca8785d Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 24 Feb 2019 13:34:41 +0300 Subject: [PATCH] tests: fix memory leaks. Signed-off-by: Andrew Borodin --- tests/lib/serialize.c | 2 ++ tests/lib/vfs/path_serialize.c | 4 ++++ tests/src/vfs/extfs/helpers-list/mc_parse_ls_l.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/tests/lib/serialize.c b/tests/lib/serialize.c index 08c9c692c..09b7c375e 100644 --- a/tests/lib/serialize.c +++ b/tests/lib/serialize.c @@ -97,6 +97,8 @@ START_PARAMETRIZED_TEST (test_serialize, test_serialize_ds) g_free (actual_result); + if (error != NULL) + g_error_free (error); } /* *INDENT-OFF* */ END_PARAMETRIZED_TEST diff --git a/tests/lib/vfs/path_serialize.c b/tests/lib/vfs/path_serialize.c index a82ca5551..4436e2fc4 100644 --- a/tests/lib/vfs/path_serialize.c +++ b/tests/lib/vfs/path_serialize.c @@ -155,8 +155,12 @@ START_TEST (test_path_serialize) /* when */ vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER); serialized_vpath = vfs_path_serialize (vpath, &error); + vfs_path_free (vpath); + if (error != NULL) + g_error_free (error); + /* then */ mctest_assert_ptr_ne (serialized_vpath, NULL); mctest_assert_str_eq (serialized_vpath, ETALON_SERIALIZED_PATH); diff --git a/tests/src/vfs/extfs/helpers-list/mc_parse_ls_l.c b/tests/src/vfs/extfs/helpers-list/mc_parse_ls_l.c index 15c40ab7c..6574f684a 100644 --- a/tests/src/vfs/extfs/helpers-list/mc_parse_ls_l.c +++ b/tests/src/vfs/extfs/helpers-list/mc_parse_ls_l.c @@ -128,6 +128,8 @@ parse_command_line (int *argc, char **argv[]) if (!g_option_context_parse (context, argc, argv, &error)) { g_print ("option parsing failed: %s\n", error->message); + g_error_free (error); + return FALSE; }