im.pidgin.pidgin: 29f8aed19e209a53a63c57cf872bc9f446d84aeb
datallah at pidgin.im
datallah at pidgin.im
Thu Nov 29 18:25:52 EST 2007
-----------------------------------------------------------------
Revision: 29f8aed19e209a53a63c57cf872bc9f446d84aeb
Ancestor: 41b4d75b70555daf78b3c5701a59453027ca57e7
Author: datallah at pidgin.im
Date: 2007-11-29T23:18:33
Branch: im.pidgin.pidgin
Modified files:
libpurple/protocols/jabber/caps.c
libpurple/protocols/jabber/presence.c
ChangeLog:
Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/caps.c 0f200abbdb34bb03989084dfb24deb3d64fe13bd
+++ libpurple/protocols/jabber/caps.c ce2b1c9933e7c617f55ff2da3801ada27fcb0c36
@@ -257,18 +257,23 @@ static JabberCapsClientInfo *jabber_caps
/* this function assumes that all information is available locally */
static JabberCapsClientInfo *jabber_caps_collect_info(const char *node, const char *ver, GList *ext) {
- JabberCapsClientInfo *result = g_new0(JabberCapsClientInfo, 1);
+ JabberCapsClientInfo *result;
JabberCapsKey *key = g_new0(JabberCapsKey, 1);
JabberCapsValue *caps;
GList *iter;
-
+
key->node = (char *)node;
key->ver = (char *)ver;
-
+
caps = g_hash_table_lookup(capstable,key);
-
+
g_free(key);
-
+
+ if (caps == NULL)
+ return NULL;
+
+ result = g_new0(JabberCapsClientInfo, 1);
+
/* join all information */
for(iter = caps->identities; iter; iter = g_list_next(iter)) {
JabberCapsIdentity *id = iter->data;
============================================================
--- libpurple/protocols/jabber/presence.c c62477cd09bf9a3f65fe6cc8929d91929aaf3906
+++ libpurple/protocols/jabber/presence.c b1c201c40e38e907e2563e547d977239ad8d4bc1
@@ -376,23 +376,26 @@ static void jabber_presence_set_capabili
static void jabber_presence_set_capabilities(JabberCapsClientInfo *info, gpointer user_data) {
JabberPresenceCapabilities *userdata = user_data;
GList *iter;
-
+
if(userdata->jbr->caps)
jabber_caps_free_clientinfo(userdata->jbr->caps);
userdata->jbr->caps = info;
-
- for(iter = info->features; iter; iter = g_list_next(iter)) {
- if(!strcmp((const char*)iter->data, "http://jabber.org/protocol/commands")) {
- JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
- xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items");
- xmlnode_set_attrib(iq->node, "to", userdata->from);
- xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands");
-
- jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL);
- jabber_iq_send(iq);
- break;
+
+ if (info) {
+ for(iter = info->features; iter; iter = g_list_next(iter)) {
+ if(!strcmp((const char*)iter->data, "http://jabber.org/protocol/commands")) {
+ JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
+ xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items");
+ xmlnode_set_attrib(iq->node, "to", userdata->from);
+ xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands");
+
+ jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL);
+ jabber_iq_send(iq);
+ break;
+ }
}
}
+
g_free(userdata->from);
g_free(userdata);
}
More information about the Commits
mailing list