Changeset 098a75b for protocols


Ignore:
Timestamp:
2015-03-22T13:35:08Z (10 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
b95d03b
Parents:
2dd23da
git-author:
dequis <dx@…> (21-03-15 08:26:20)
git-committer:
dequis <dx@…> (22-03-15 13:35:08)
Message:

Fix a bunch of memory leaks

  • irc_im.c:
    • bee_irc_user_msg: strdup leaks when otr swallows messages
    • bee_irc_user_action_response: GString leak in all ctcp replies
  • otr.c:
    • call g_slist_free() on the list of the otr_policy setting
    • otr_filter_msg_in: call otrl_tlv_free() if "tlvs" are returned
    • otr_filter_msg_out: don't g_strdup() if the message should be ignored
    • log_otr_message: g_strdup_vprintf() leaks always
  • nogaim.c:
    • imcb_ask_auth/imcb_ask_add: leaks in g_strdup_printf()
    • imcb_ask_add leaks imcb_ask_cb_data if the user already exists
    • add imcb_ask_cb_free() to correctly free its data
  • msn_util.c: add msn_buddy_ask_free(), ditto
  • storage_xml.c: pass_cr/password if base64_decode or arc_decode fail
  • ssl_gnutls.c: conn->hostname leak in error conditions, like invalid certs
  • jabber_util.c: jabber_buddy_by_ext_jid() leaks jid if it's not an ext jid
Location:
protocols
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber_util.c

    r2dd23da r098a75b  
    566566
    567567        if ((s = strchr(jid, '=')) == NULL) {
     568                g_free(jid);
    568569                return NULL;
    569570        }
  • protocols/msn/msn_util.c

    r2dd23da r098a75b  
    174174};
    175175
    176 static void msn_buddy_ask_yes(void *data)
     176static void msn_buddy_ask_free(void *data)
    177177{
    178178        struct msn_buddy_ask_data *bla = data;
    179 
    180         msn_buddy_list_add(bla->ic, MSN_BUDDY_AL, bla->handle, bla->realname, NULL);
    181 
    182         imcb_ask_add(bla->ic, bla->handle, NULL);
    183179
    184180        g_free(bla->handle);
     
    187183}
    188184
     185static void msn_buddy_ask_yes(void *data)
     186{
     187        struct msn_buddy_ask_data *bla = data;
     188
     189        msn_buddy_list_add(bla->ic, MSN_BUDDY_AL, bla->handle, bla->realname, NULL);
     190
     191        imcb_ask_add(bla->ic, bla->handle, NULL);
     192
     193        msn_buddy_ask_free(bla);
     194}
     195
    189196static void msn_buddy_ask_no(void *data)
    190197{
     
    193200        msn_buddy_list_add(bla->ic, MSN_BUDDY_BL, bla->handle, bla->realname, NULL);
    194201
    195         g_free(bla->handle);
    196         g_free(bla->realname);
    197         g_free(bla);
     202        msn_buddy_ask_free(bla);
    198203}
    199204
     
    216221                   "The user %s (%s) wants to add you to his/her buddy list.",
    217222                   bu->handle, bu->fullname);
    218         imcb_ask(bu->ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no);
     223
     224        imcb_ask_with_free(bu->ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no, msn_buddy_ask_free);
    219225}
    220226
  • protocols/nogaim.c

    r2dd23da r098a75b  
    498498};
    499499
    500 static void imcb_ask_auth_cb_no(void *data)
     500static void imcb_ask_cb_free(void *data)
    501501{
    502502        struct imcb_ask_cb_data *cbd = data;
    503 
    504         cbd->ic->acc->prpl->auth_deny(cbd->ic, cbd->handle);
    505503
    506504        g_free(cbd->handle);
     
    508506}
    509507
     508static void imcb_ask_auth_cb_no(void *data)
     509{
     510        struct imcb_ask_cb_data *cbd = data;
     511
     512        cbd->ic->acc->prpl->auth_deny(cbd->ic, cbd->handle);
     513
     514        imcb_ask_cb_free(cbd);
     515}
     516
    510517static void imcb_ask_auth_cb_yes(void *data)
    511518{
     
    514521        cbd->ic->acc->prpl->auth_allow(cbd->ic, cbd->handle);
    515522
    516         g_free(cbd->handle);
    517         g_free(cbd);
     523        imcb_ask_cb_free(cbd);
    518524}
    519525
     
    535541        data->handle = g_strdup(handle);
    536542        query_add((irc_t *) ic->bee->ui_data, ic, s,
    537                   imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, g_free, data);
    538 }
    539 
    540 
    541 static void imcb_ask_add_cb_no(void *data)
    542 {
    543         g_free(((struct imcb_ask_cb_data*) data)->handle);
    544         g_free(data);
     543                  imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, imcb_ask_cb_free, data);
     544
     545        g_free(s);
    545546}
    546547
     
    551552        cbd->ic->acc->prpl->add_buddy(cbd->ic, cbd->handle, NULL);
    552553
    553         imcb_ask_add_cb_no(data);
     554        imcb_ask_cb_free(data);
    554555}
    555556
    556557void imcb_ask_add(struct im_connection *ic, const char *handle, const char *realname)
    557558{
    558         struct imcb_ask_cb_data *data = g_new0(struct imcb_ask_cb_data, 1);
     559        struct imcb_ask_cb_data *data;
    559560        char *s;
    560561
     
    564565        }
    565566
     567        data = g_new0(struct imcb_ask_cb_data, 1);
     568
    566569        s = g_strdup_printf("The user %s is not in your buddy list yet. Do you want to add him/her now?", handle);
    567570
     
    569572        data->handle = g_strdup(handle);
    570573        query_add((irc_t *) ic->bee->ui_data, ic, s,
    571                   imcb_ask_add_cb_yes, imcb_ask_add_cb_no, g_free, data);
     574                  imcb_ask_add_cb_yes, imcb_ask_cb_free, imcb_ask_cb_free, data);
     575
     576        g_free(s);
    572577}
    573578
Note: See TracChangeset for help on using the changeset viewer.