Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
GDBusProxy: on_properties_changed initialize some variables
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Matthias Clasen committed Aug 13, 2011
1 parent 655299a commit ae496a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gio/gdbusproxy.c
Expand Up @@ -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)
Expand All @@ -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;

Expand Down

0 comments on commit ae496a5

Please sign in to comment.