[gvfs] proxy volume monitor: Fix invalid read



commit cc9e1249b08e1db213baaddb77914f5394bffb69
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Sun Apr 6 15:23:54 2014 +0100

    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

 monitor/proxy/gvfsproxyvolumemonitordaemon.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/monitor/proxy/gvfsproxyvolumemonitordaemon.c b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
index e0d19ae..768d307 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


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