[glib/wip/gcleanup] sources: Fix leaks in tests
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup] sources: Fix leaks in tests
- Date: Sat, 9 Nov 2013 19:58:11 +0000 (UTC)
commit 6c9588c709a984133ce444bebf1496f719a3892e
Author: Stef Walter <stefw gnome org>
Date: Sat Nov 9 20:27:57 2013 +0100
sources: Fix leaks in tests
tests/sources.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/tests/sources.c b/tests/sources.c
index 35edb85..9bd2b15 100644
--- a/tests/sources.c
+++ b/tests/sources.c
@@ -54,6 +54,7 @@ thread_pool_attach_func (gpointer data,
GSource *source = data;
g_source_attach (source, context);
+ g_source_unref (source);
}
static void
@@ -103,7 +104,10 @@ main (int argc, char **argv)
start = g_get_monotonic_time ();
for (i = 0; i < NSOURCES; i++)
- g_source_destroy (sources[i]);
+ {
+ g_source_destroy (sources[i]);
+ g_source_unref (sources[i]);
+ }
end = g_get_monotonic_time ();
g_print ("Remove in random order: %" G_GINT64_FORMAT "\n",
(end - start) / 1000);
@@ -136,7 +140,10 @@ main (int argc, char **argv)
start = g_get_monotonic_time ();
for (i = 0; i < NSOURCES; i++)
- g_source_destroy (sources[i]);
+ {
+ g_source_destroy (sources[i]);
+ g_source_unref (sources[i]);
+ }
end = g_get_monotonic_time ();
g_print ("Remove in random order: %" G_GINT64_FORMAT "\n",
(end - start) / 1000);
@@ -175,5 +182,6 @@ main (int argc, char **argv)
/* Make sure they really did get removed */
g_main_context_iteration (context, FALSE);
+ g_free (sources);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]