# HG changeset patch # User Paul Aurich # Date 1241204371 0 # Node ID 966d2f2f86c80d9075bf9c322242742f16a305ee # Parent 47d03538ee3f0b6df64b268586ba45b21d789684 Don't crash when the caps cb is NULL and don't corrupt jabber_identities diff -r 47d03538ee3f -r 966d2f2f86c8 libpurple/protocols/jabber/caps.c --- a/libpurple/protocols/jabber/caps.c Fri May 01 18:57:44 2009 +0000 +++ b/libpurple/protocols/jabber/caps.c Fri May 01 18:59:31 2009 +0000 @@ -406,9 +406,11 @@ static void jabber_caps_get_info_complete(jabber_caps_cbplususerdata *userdata) { - userdata->cb(userdata->info, userdata->exts, userdata->cb_data); - userdata->info = NULL; - userdata->exts = NULL; + if (userdata->cb) { + userdata->cb(userdata->info, userdata->exts, userdata->cb_data); + userdata->info = NULL; + userdata->exts = NULL; + } if (userdata->ref != 1) purple_debug_warning("jabber", "Lost a reference to caps cbdata: %d\n", @@ -562,7 +564,8 @@ info = g_hash_table_lookup(capstable, &key); if (info && hash) { /* v1.5 - We already have all the information we care about */ - cb(info, NULL, user_data); + if (cb) + cb(info, NULL, user_data); return; } @@ -896,11 +899,12 @@ } info.features = features; - info.identities = jabber_identities; + info.identities = g_list_copy(jabber_identities); info.forms = NULL; g_free(js->caps_hash); js->caps_hash = jabber_caps_calculate_hash(&info, "sha1"); + g_list_free(info.identities); g_list_free(features); } diff -r 47d03538ee3f -r 966d2f2f86c8 libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Fri May 01 18:57:44 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Fri May 01 18:59:31 2009 +0000 @@ -1807,7 +1807,7 @@ ident->type = g_strdup(type); ident->lang = g_strdup(lang); ident->name = g_strdup(name); - jabber_identities = g_list_append(jabber_identities, ident); + jabber_identities = g_list_prepend(jabber_identities, ident); } static void jabber_identities_destroy(void)