summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2014-04-06 15:23:54 +0100
committerRoss Lagerwall <rosslagerwall@gmail.com>2014-04-10 17:27:48 +0100
commitcc9e1249b08e1db213baaddb77914f5394bffb69 (patch)
treefc9cb550ad386db2fee5281e2313bdcea75309ba
parent8d6a969c21d70ac389b84ab0b39d3506ea0fe568 (diff)
downloadgvfs-cc9e1249b08e1db213baaddb77914f5394bffb69.tar.gz
proxy volume monitor: Fix invalid read
When g_bus_unwatch_name () is called, it frees the associated Client and so the name variable becomes invalid. So, ensure that nothing uses the name variable after this call. https://bugzilla.gnome.org/show_bug.cgi?id=710679
-rw-r--r--monitor/proxy/gvfsproxyvolumemonitordaemon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/monitor/proxy/gvfsproxyvolumemonitordaemon.c b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
index e0d19ae9..768d307a 100644
--- a/monitor/proxy/gvfsproxyvolumemonitordaemon.c
+++ b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
@@ -479,16 +479,16 @@ on_name_owner_vanished (GDBusConnection *connection,
/* unwatch the name */
name_watcher_id = GPOINTER_TO_UINT (g_hash_table_lookup (unique_names_being_watched, name));
+ g_hash_table_remove (unique_names_being_watched, name);
if (name_watcher_id == 0)
{
g_warning ("Was asked to remove match rule for unique_name %s but we don't have one", name);
}
else
{
+ /* Note that calling g_bus_unwatch_name () makes @name invalid */
g_bus_unwatch_name (name_watcher_id);
}
-
- g_hash_table_remove (unique_names_being_watched, name);
}
static void