[glib] GDBusProxy: on_properties_changed initialize some variables



commit ae496a52a92c137b624eee3f5cf54e7756143086
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 13 16:09:41 2011 -0400

    GDBusProxy: on_properties_changed initialize some variables
    
    This avoids calling g_variant_unref and g_free on uninitialized memory
    if PropertiesChanged is received in the creating thread's thread-default
    main context's thread, at the same time as releasing the last ref in
    another thread. This would result in "goto out" before the variables
    freed after that label had been initialized to NULL.
    
    Based on a patch by Simon McVittie, bug 656282

 gio/gdbusproxy.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index 4a321f7..a0e0180 100644
--- a/gio/gdbusproxy.c
+++ b/gio/gdbusproxy.c
@@ -928,6 +928,9 @@ on_properties_changed (GDBusConnection *connection,
   GVariant *value;
   guint n;
 
+  changed_properties = NULL;
+  invalidated_properties = NULL;
+
   G_LOCK (signal_subscription_lock);
   proxy = data->proxy;
   if (proxy == NULL)
@@ -941,9 +944,6 @@ on_properties_changed (GDBusConnection *connection,
       G_UNLOCK (signal_subscription_lock);
     }
 
-  changed_properties = NULL;
-  invalidated_properties = NULL;
-
   if (!proxy->priv->initialized)
     goto out;
 



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