]> git.0d.be Git - empathy.git/commitdiff
don't leak the classes list
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 30 Mar 2010 08:18:10 +0000 (10:18 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 30 Mar 2010 09:20:59 +0000 (11:20 +0200)
src/empathy-new-chatroom-dialog.c

index 11bf0835c30de2059142e03720c7078cac38f881..c814e4433427b7ed163832eccebc2bca07c52e82 100644 (file)
@@ -484,6 +484,7 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
        gboolean               expanded = FALSE;
        TpConnection          *connection;
        EmpathyDispatcher     *dispatcher;
+       GList                 *classes = NULL;
 
        if (dialog->room_list) {
                g_object_unref (dialog->room_list);
@@ -509,12 +510,19 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
 
        dispatcher = empathy_dispatcher_dup_singleton ();
 
-       if (connection != NULL &&
-           empathy_dispatcher_find_requestable_channel_classes (dispatcher,
-               connection, TP_IFACE_CHANNEL_TYPE_ROOM_LIST,
-               TP_HANDLE_TYPE_NONE, NULL) != NULL) {
+       if (connection != NULL) {
+               classes = empathy_dispatcher_find_requestable_channel_classes (dispatcher,
+                       connection, TP_IFACE_CHANNEL_TYPE_ROOM_LIST,
+                       TP_HANDLE_TYPE_NONE, NULL);
+       }
+
+       if (classes != NULL) {
                /* Roomlist channels are supported */
                dialog->room_list = empathy_tp_roomlist_new (dialog->account);
+               g_list_free (classes);
+       }
+       else {
+               dialog->room_list = NULL;
        }
 
        g_object_unref (dispatcher);