diff options
author | Philip Withnall <withnall@endlessm.com> | 2019-08-22 11:27:43 +0300 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2019-09-02 14:16:33 +0100 |
commit | 39052a1cfc76d8d3a1a1888d85d3a359a6631932 (patch) | |
tree | 4570da411c4fb5ab2931ea817cbbd7b546ce8bdb | |
parent | 8ae07a727abcc157f3ff5a5185903f737a1c3a72 (diff) | |
download | glib-39052a1cfc76d8d3a1a1888d85d3a359a6631932.tar.gz |
tests: Fix some minor memory leaks in tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>
-rw-r--r-- | gio/tests/glistmodel.c | 1 | ||||
-rw-r--r-- | glib/tests/autoptr.c | 10 |
2 files changed, 8 insertions, 3 deletions
diff --git a/gio/tests/glistmodel.c b/gio/tests/glistmodel.c index b867bd54a..562037f62 100644 --- a/gio/tests/glistmodel.c +++ b/gio/tests/glistmodel.c @@ -798,6 +798,7 @@ test_store_past_end (void) g_assert_cmpint (g_list_model_get_n_items (model), ==, 1); item = g_list_model_get_item (model, 0); g_assert_nonnull (item); + g_object_unref (item); item = g_list_model_get_item (model, G_MAXUINT); g_assert_null (item); diff --git a/glib/tests/autoptr.c b/glib/tests/autoptr.c index d24ad1ed8..fccdfe55e 100644 --- a/glib/tests/autoptr.c +++ b/glib/tests/autoptr.c @@ -409,9 +409,11 @@ test_g_rec_mutex_locker (void) g_thread_join (thread); } - /* Verify that the mutex is unlocked again */ - thread = g_thread_new ("rec mutex unlocked", rec_mutex_unlocked_thread, &rec_mutex); - g_thread_join (thread); + /* Verify that the mutex is unlocked again */ + thread = g_thread_new ("rec mutex unlocked", rec_mutex_unlocked_thread, &rec_mutex); + g_thread_join (thread); + + g_rec_mutex_clear (&rec_mutex); } /* Thread function to check that an rw lock given in @data cannot be writer locked */ @@ -478,6 +480,8 @@ test_g_rw_lock_lockers (void) * the locks taken above have been correctly released. */ g_assert_true (g_rw_lock_writer_trylock (&lock)); g_rw_lock_writer_unlock (&lock); + + g_rw_lock_clear (&lock); } static void |