[libdazzle] tests: fix some leaks under asan



commit 36d64ffdb1e6397dda9f0917a9bbb344764feb6a
Author: Christian Hergert <chergert redhat com>
Date:   Wed Dec 13 21:49:45 2017 -0800

    tests: fix some leaks under asan

 tests/test-recursive-monitor.c |    9 +++++++--
 tests/test-trie.c              |    2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/tests/test-recursive-monitor.c b/tests/test-recursive-monitor.c
index c77cc6a..f2e187d 100644
--- a/tests/test-recursive-monitor.c
+++ b/tests/test-recursive-monitor.c
@@ -145,11 +145,11 @@ test_basic (void)
   state.created = g_hash_table_new_full (g_file_hash,
                                          (GEqualFunc) g_file_equal,
                                          g_object_unref,
-                                         g_object_unref);
+                                         NULL);
   state.deleted = g_hash_table_new_full (g_file_hash,
                                          (GEqualFunc) g_file_equal,
                                          g_object_unref,
-                                         g_object_unref);
+                                         NULL);
 
   /* Cleanup any previously failed run */
   if (g_file_test ("recursive-dir", G_FILE_TEST_EXISTS))
@@ -192,6 +192,11 @@ test_basic (void)
   g_main_loop_run (state.main_loop);
 
   dzl_recursive_file_monitor_cancel (state.monitor);
+
+  g_clear_pointer (&state.main_loop, g_main_loop_unref);
+  g_clear_pointer (&state.created, g_hash_table_unref);
+  g_clear_pointer (&state.deleted, g_hash_table_unref);
+  g_clear_object (&state.monitor);
 }
 
 gint
diff --git a/tests/test-trie.c b/tests/test-trie.c
index 4b934a1..88b0f47 100644
--- a/tests/test-trie.c
+++ b/tests/test-trie.c
@@ -124,6 +124,8 @@ test_dzl_trie_gauntlet (void)
 
    g_strfreev(words);
    words = NULL;
+
+   g_timer_destroy (timer);
 }
 
 gint


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