comparison libpurple/protocols/jabber/caps.c @ 21688:6f4ffdc65230

Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 29 Nov 2007 23:18:33 +0000
parents 5f85d0781bee
children aaaff38e144f d79c30d1582a 26eabe8e739b 92e71f6e10d4
comparison
equal deleted inserted replaced
21684:c6487d5385f9 21688:6f4ffdc65230
255 g_free(str); 255 g_free(str);
256 } 256 }
257 257
258 /* this function assumes that all information is available locally */ 258 /* this function assumes that all information is available locally */
259 static JabberCapsClientInfo *jabber_caps_collect_info(const char *node, const char *ver, GList *ext) { 259 static JabberCapsClientInfo *jabber_caps_collect_info(const char *node, const char *ver, GList *ext) {
260 JabberCapsClientInfo *result = g_new0(JabberCapsClientInfo, 1); 260 JabberCapsClientInfo *result;
261 JabberCapsKey *key = g_new0(JabberCapsKey, 1); 261 JabberCapsKey *key = g_new0(JabberCapsKey, 1);
262 JabberCapsValue *caps; 262 JabberCapsValue *caps;
263 GList *iter; 263 GList *iter;
264 264
265 key->node = (char *)node; 265 key->node = (char *)node;
266 key->ver = (char *)ver; 266 key->ver = (char *)ver;
267 267
268 caps = g_hash_table_lookup(capstable,key); 268 caps = g_hash_table_lookup(capstable,key);
269 269
270 g_free(key); 270 g_free(key);
271 271
272 if (caps == NULL)
273 return NULL;
274
275 result = g_new0(JabberCapsClientInfo, 1);
276
272 /* join all information */ 277 /* join all information */
273 for(iter = caps->identities; iter; iter = g_list_next(iter)) { 278 for(iter = caps->identities; iter; iter = g_list_next(iter)) {
274 JabberCapsIdentity *id = iter->data; 279 JabberCapsIdentity *id = iter->data;
275 JabberCapsIdentity *newid = g_new0(JabberCapsIdentity, 1); 280 JabberCapsIdentity *newid = g_new0(JabberCapsIdentity, 1);
276 newid->category = g_strdup(id->category); 281 newid->category = g_strdup(id->category);