[empathy] chatroom_manager_parse_chatroom: check account path is valid



commit 6dfd7204baa89c6eb3903753f45b7d416a93b112
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Aug 29 11:32:36 2011 +0200

    chatroom_manager_parse_chatroom: check account path is valid
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657362

 libempathy/empathy-chatroom-manager.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index bf9ecf1..043f8a8 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -210,7 +210,7 @@ static void
 chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
     xmlNodePtr node)
 {
-  EmpathyChatroom *chatroom;
+  EmpathyChatroom *chatroom = NULL;
   TpAccount *account;
   xmlNodePtr child;
   gchar *str;
@@ -269,6 +269,11 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
       xmlFree (str);
     }
 
+  /* account has to be a valid Account object path */
+  if (!tp_dbus_check_valid_object_path (account_id, NULL) ||
+      !g_str_has_prefix (account_id, TP_ACCOUNT_OBJECT_PATH_BASE))
+    goto out;
+
   factory = empathy_client_factory_dup ();
 
   account = tp_simple_client_factory_ensure_account (
@@ -292,10 +297,11 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
   add_chatroom (manager, chatroom);
   g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
 
+out:
   g_free (name);
   g_free (room);
   g_free (account_id);
-  g_object_unref (chatroom);
+  tp_clear_object (&chatroom);
 }
 
 static gboolean



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