[glib/wip/gcleanup: 76/79] timeloop-closure: Fix leaks in test
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup: 76/79] timeloop-closure: Fix leaks in test
- Date: Sun, 10 Nov 2013 15:25:54 +0000 (UTC)
commit 2d9e3bf713260412090a42e90c6c77e48302d1a8
Author: Stef Walter <stefw gnome org>
Date: Sun Nov 10 15:57:12 2013 +0100
timeloop-closure: Fix leaks in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
tests/gobject/timeloop-closure.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/tests/gobject/timeloop-closure.c b/tests/gobject/timeloop-closure.c
index 13ce760..9de00d3 100644
--- a/tests/gobject/timeloop-closure.c
+++ b/tests/gobject/timeloop-closure.c
@@ -122,9 +122,6 @@ input_callback (GIOChannel *source,
{
g_io_channel_close (source);
g_io_channel_close (dest);
-
- g_io_channel_unref (source);
- g_io_channel_unref (dest);
n_active_children--;
if (n_active_children == 0)
@@ -154,8 +151,15 @@ create_child (void)
source = g_io_create_watch (out_channels[0], G_IO_IN | G_IO_HUP);
g_source_set_closure (source,
- g_cclosure_new (G_CALLBACK (input_callback), in_channels[1], NULL));
+ g_cclosure_new (G_CALLBACK (input_callback), in_channels[1],
+ (GClosureNotify)g_io_channel_unref));
g_source_attach (source, NULL);
+ g_source_unref (source);
+
+ g_io_channel_unref (in_channels[0]);
+ g_io_channel_unref (out_channels[0]);
+ g_io_channel_unref (out_channels[1]);
+
}
else if (pid == 0) /* Child */
{
@@ -216,5 +220,7 @@ main (int argc, char **argv)
difftimeval (&old_usage.ru_stime, &new_usage.ru_stime)) /
(n_iters * n_children));
+ g_main_loop_unref (loop);
+
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]