summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Sankar Guntur <ravi.g@samsung.com>2012-02-06 23:10:34 +0530
committerColin Walters <walters@verbum.org>2012-02-08 09:36:12 -0500
commit90dbaca92477aeb6e1facac5dd8172e0d5319d4e (patch)
tree23bceea80f9e7de4f296dbaafede7f61f4f5b861
parentbd79c00537756ca24423e51f11cae008111ab7d2 (diff)
downloadglib-90dbaca92477aeb6e1facac5dd8172e0d5319d4e.tar.gz
glib/tests: mainloop - fix a mem leak.
https://bugzilla.gnome.org/show_bug.cgi?id=669372 Signed-off-by: Ravi Sankar Guntur <ravi.g@samsung.com>
-rw-r--r--glib/tests/mainloop.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index 7372f9737..8391a7674 100644
--- a/glib/tests/mainloop.c
+++ b/glib/tests/mainloop.c
@@ -27,12 +27,31 @@ static gboolean cb (gpointer data)
return FALSE;
}
+static gboolean prepare (GSource *source, gint *time)
+{
+ return FALSE;
+}
+static gboolean check (GSource *source)
+{
+ return FALSE;
+}
+static gboolean dispatch (GSource *source, GSourceFunc cb, gpointer date)
+{
+ return FALSE;
+}
+
+GSourceFuncs funcs = {
+ prepare,
+ check,
+ dispatch,
+ NULL
+};
+
static void
test_maincontext_basic (void)
{
GMainContext *ctx;
GSource *source;
- GSourceFuncs funcs;
guint id;
gpointer data = &funcs;
@@ -58,6 +77,7 @@ test_maincontext_basic (void)
g_assert (g_main_context_find_source_by_funcs_user_data (ctx, &funcs, NULL) == NULL);
id = g_source_attach (source, ctx);
+ g_source_unref (source);
g_assert_cmpint (g_source_get_id (source), ==, id);
g_assert (g_main_context_find_source_by_id (ctx, id) == source);
@@ -72,6 +92,7 @@ test_maincontext_basic (void)
g_source_set_funcs (source, &funcs);
g_source_set_callback (source, cb, data, NULL);
id = g_source_attach (source, ctx);
+ g_source_unref (source);
g_source_set_name_by_id (id, "e");
g_assert_cmpstr (g_source_get_name (source), ==, "e");
g_assert (g_source_get_context (source) == ctx);