[tracker: 3/21] tests/libtracker-common: Fix memory leaks



commit 33fd803213846e6584acd7f186764c3e21a63d32
Author: Andrea Azzarone <andrea azzarone canonical com>
Date:   Fri Jan 18 16:55:17 2019 +0000

    tests/libtracker-common: Fix memory leaks
    
    Make sure to call g_free on result in tracker-file-utils-test.c

 tests/libtracker-common/tracker-file-utils-test.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/tests/libtracker-common/tracker-file-utils-test.c 
b/tests/libtracker-common/tracker-file-utils-test.c
index 93a409b37..2e2f58f97 100644
--- a/tests/libtracker-common/tracker-file-utils-test.c
+++ b/tests/libtracker-common/tracker-file-utils-test.c
@@ -165,6 +165,7 @@ test_path_evaluate_name (void)
 
        result = tracker_path_evaluate_name ("just-a-filename");
        g_assert_cmpstr (result, ==, "just-a-filename");
+       g_free (result);
 
        result = tracker_path_evaluate_name ("$HOME/all/dir/");
        expected = g_build_path (G_DIR_SEPARATOR_S, home, "/all/dir", NULL);
@@ -200,21 +201,25 @@ test_path_evaluate_name (void)
 
        result = tracker_path_evaluate_name ("");
        g_assert (!result);
+       g_free (result);
 
        result = tracker_path_evaluate_name (NULL);
        g_assert (!result);
-
+       g_free (result);
 
         g_setenv ("HOME", "", TRUE);
         result = tracker_path_evaluate_name ("~/but-no-home.txt");
         g_assert (!result);
+        g_free (result);
         g_setenv ("HOME", home, TRUE);
 
         result = tracker_path_evaluate_name ("$UNDEFINED/something");
         g_assert_cmpstr (result, ==, "/something");
+        g_free (result);
 
        result = tracker_path_evaluate_name (tracker_test_helpers_get_nonutf8 ());
        g_assert_cmpstr (result, ==, tracker_test_helpers_get_nonutf8 ());
+       g_free (result);
 
        g_unsetenv ("TEST_TRACKER_DIR");
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]