[sysprof] libsysprof-capture: unref GSource after attaching



commit 36860b449e76f4f4f27a5f02c20898aa9868bb20
Author: Christian Hergert <chergert redhat com>
Date:   Sat Feb 15 22:27:34 2020 -0700

    libsysprof-capture: unref GSource after attaching

 src/libsysprof-capture/mapped-ring-buffer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/libsysprof-capture/mapped-ring-buffer.c b/src/libsysprof-capture/mapped-ring-buffer.c
index 8900beb..061656e 100644
--- a/src/libsysprof-capture/mapped-ring-buffer.c
+++ b/src/libsysprof-capture/mapped-ring-buffer.c
@@ -587,6 +587,7 @@ mapped_ring_buffer_create_source_full (MappedRingBuffer         *self,
                                        GDestroyNotify            destroy)
 {
   MappedRingSource *source;
+  guint ret;
 
   g_return_val_if_fail (self != NULL, 0);
   g_return_val_if_fail (source_func != NULL, 0);
@@ -595,8 +596,10 @@ mapped_ring_buffer_create_source_full (MappedRingBuffer         *self,
   source->self = mapped_ring_buffer_ref (self);
   g_source_set_callback ((GSource *)source, (GSourceFunc)source_func, user_data, destroy);
   g_source_set_name ((GSource *)source, "MappedRingSource");
+  ret = g_source_attach ((GSource *)source, g_main_context_default ());
+  g_source_unref ((GSource *)source);
 
-  return g_source_attach ((GSource *)source, g_main_context_default ());
+  return ret;
 }
 
 guint


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