]> andersk Git - libfaim.git/blobdiff - src/im.c
leak plugging. mid told me i could.
[libfaim.git] / src / im.c
index 4a604d8f4e5f212ad28c4b9f55d316a6a499137e..20bd1ba32b0d4775d3fa16f8734a10c8c2586864 100644 (file)
--- a/src/im.c
+++ b/src/im.c
@@ -145,7 +145,7 @@ faim_export fu32_t aim_iconsum(const fu8_t *buf, int buflen)
 faim_export int aim_send_im_ext(aim_session_t *sess, aim_conn_t *conn, struct aim_sendimext_args *args)
 {
        static const fu8_t deffeatures[] = {
-               0x01, 0x01, 0x01, 0x02, 0x42,
+               0x01, 0x01, 0x01, 0x02
        };
        int i, msgtlvlen;
        aim_frame_t *fr;
@@ -962,7 +962,8 @@ static int incomingim_ch2_buddyicon(aim_session_t *sess, aim_module_t *mod, aim_
        aim_tlv_t *miscinfo;
        aim_bstream_t tbs;
 
-       miscinfo = aim_gettlv(list2, 0x2711, 1);
+       if (!(miscinfo = aim_gettlv(list2, 0x2711, 1)))
+               return 0;
        aim_bstream_init(&tbs, miscinfo->value, miscinfo->length);
 
        args->info.icon.checksum = aimbs_get32(&tbs);
@@ -1574,6 +1575,9 @@ static int clienterr(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, ai
        if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
                 ret = userfunc(sess, rx, channel, sn, reason);
 
+       free(ck);
+       free(sn);
+
        return ret;
 }
 
@@ -1583,6 +1587,7 @@ static int msgack(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_m
        fu16_t type;
        fu8_t snlen, *ck;
        char *sn;
+       int ret = 0;
 
        ck = aimbs_getraw(bs, 8);
        type = aimbs_get16(bs);
@@ -1590,12 +1595,12 @@ static int msgack(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_m
        sn = aimbs_getstr(bs, snlen);
 
        if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-               return userfunc(sess, rx, type, sn);
+               ret = userfunc(sess, rx, type, sn);
 
        free(sn);
        free(ck);
 
-       return 0;
+       return ret;
 }
 
 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
This page took 0.084235 seconds and 4 git commands to generate.