[gupnp] Don't leak CallbackData



commit c186160360358eeee069766bcf65447996cf6e25
Author: Jens Georg <mail jensge org>
Date:   Sat May 24 17:53:14 2014 +0200

    Don't leak CallbackData
    
    If a ServiceProxy was unref'ed with notifies still added, callback data
    would be leaked.
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730690

 libgupnp/gupnp-service-proxy.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index ec76277..ed8cc6c 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -134,9 +134,16 @@ gupnp_service_proxy_action_free (GUPnPServiceProxyAction *action)
 }
 
 static void
+callback_data_free (CallbackData *data)
+{
+        g_slice_free (CallbackData, data);
+}
+
+static void
 notify_data_free (NotifyData *data)
 {
-        g_list_free (data->callbacks);
+        g_list_free_full (data->callbacks,
+                          (GDestroyNotify) callback_data_free);
 
         g_slice_free (NotifyData, data);
 }


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