comparison libpurple/protocols/oscar/family_feedbag.c @ 17235:1927f4ead3ca

Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 22 May 2007 18:56:09 +0000
parents 0a3ae69a25ea
children f80f7e1047be
comparison
equal deleted inserted replaced
17234:12d0ad970a15 17235:1927f4ead3ca
79 79
80 /* Build the new TLV list */ 80 /* Build the new TLV list */
81 if (newlen > 0) { 81 if (newlen > 0) {
82 guint8 *newdata; 82 guint8 *newdata;
83 83
84 newdata = (guint8 *)malloc((newlen)*sizeof(guint8)); 84 newdata = (guint8 *)g_malloc((newlen)*sizeof(guint8));
85 newlen = 0; 85 newlen = 0;
86 if (group->gid == 0x0000) { 86 if (group->gid == 0x0000) {
87 for (cur=list; cur; cur=cur->next) 87 for (cur=list; cur; cur=cur->next)
88 if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) 88 if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000))
89 newlen += aimutil_put16(newdata+newlen, cur->gid); 89 newlen += aimutil_put16(newdata+newlen, cur->gid);
92 if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) 92 if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY))
93 newlen += aimutil_put16(newdata+newlen, cur->bid); 93 newlen += aimutil_put16(newdata+newlen, cur->bid);
94 } 94 }
95 aim_tlvlist_replace_raw(&group->data, 0x00c8, newlen, newdata); 95 aim_tlvlist_replace_raw(&group->data, 0x00c8, newlen, newdata);
96 96
97 free(newdata); 97 g_free(newdata);
98 } 98 }
99 } 99 }
100 100
101 /** 101 /**
102 * Locally add a new item to the given item list. 102 * Locally add a new item to the given item list.
113 static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, const char *name, guint16 gid, guint16 bid, guint16 type, aim_tlvlist_t *data) 113 static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, const char *name, guint16 gid, guint16 bid, guint16 type, aim_tlvlist_t *data)
114 { 114 {
115 gboolean exists; 115 gboolean exists;
116 struct aim_ssi_item *cur, *new; 116 struct aim_ssi_item *cur, *new;
117 117
118 new = (struct aim_ssi_item *)malloc(sizeof(struct aim_ssi_item)); 118 new = (struct aim_ssi_item *)g_malloc(sizeof(struct aim_ssi_item));
119 119
120 /* Set the name */ 120 /* Set the name */
121 if (name) { 121 if (name) {
122 new->name = (char *)malloc((strlen(name)+1)*sizeof(char)); 122 new->name = (char *)g_malloc((strlen(name)+1)*sizeof(char));
123 strcpy(new->name, name); 123 strcpy(new->name, name);
124 } else 124 } else
125 new->name = NULL; 125 new->name = NULL;
126 126
127 /* Set the group ID# and buddy ID# */ 127 /* Set the group ID# and buddy ID# */
211 if (cur->next) 211 if (cur->next)
212 cur->next = del->next; 212 cur->next = del->next;
213 } 213 }
214 214
215 /* Free the removed item */ 215 /* Free the removed item */
216 free(del->name); 216 g_free(del->name);
217 aim_tlvlist_free(&del->data); 217 aim_tlvlist_free(&del->data);
218 free(del); 218 g_free(del);
219 219
220 return 0; 220 return 0;
221 } 221 }
222 222
223 /** 223 /**
508 /* Additions */ 508 /* Additions */
509 if (!od->ssi.pending) { 509 if (!od->ssi.pending) {
510 for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) { 510 for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) {
511 if (!aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid)) { 511 if (!aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid)) {
512 n++; 512 n++;
513 new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp)); 513 new = (struct aim_ssi_tmp *)g_malloc(sizeof(struct aim_ssi_tmp));
514 new->action = SNAC_SUBTYPE_FEEDBAG_ADD; 514 new->action = SNAC_SUBTYPE_FEEDBAG_ADD;
515 new->ack = 0xffff; 515 new->ack = 0xffff;
516 new->name = NULL; 516 new->name = NULL;
517 new->item = cur1; 517 new->item = cur1;
518 new->next = NULL; 518 new->next = NULL;
528 /* Deletions */ 528 /* Deletions */
529 if (!od->ssi.pending) { 529 if (!od->ssi.pending) {
530 for (cur1=od->ssi.official; cur1 && (n < 15); cur1=cur1->next) { 530 for (cur1=od->ssi.official; cur1 && (n < 15); cur1=cur1->next) {
531 if (!aim_ssi_itemlist_find(od->ssi.local, cur1->gid, cur1->bid)) { 531 if (!aim_ssi_itemlist_find(od->ssi.local, cur1->gid, cur1->bid)) {
532 n++; 532 n++;
533 new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp)); 533 new = (struct aim_ssi_tmp *)g_malloc(sizeof(struct aim_ssi_tmp));
534 new->action = SNAC_SUBTYPE_FEEDBAG_DEL; 534 new->action = SNAC_SUBTYPE_FEEDBAG_DEL;
535 new->ack = 0xffff; 535 new->ack = 0xffff;
536 new->name = NULL; 536 new->name = NULL;
537 new->item = cur1; 537 new->item = cur1;
538 new->next = NULL; 538 new->next = NULL;
549 if (!od->ssi.pending) { 549 if (!od->ssi.pending) {
550 for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) { 550 for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) {
551 cur2 = aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid); 551 cur2 = aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid);
552 if (cur2 && (aim_ssi_itemlist_cmp(cur1, cur2))) { 552 if (cur2 && (aim_ssi_itemlist_cmp(cur1, cur2))) {
553 n++; 553 n++;
554 new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp)); 554 new = (struct aim_ssi_tmp *)g_malloc(sizeof(struct aim_ssi_tmp));
555 new->action = SNAC_SUBTYPE_FEEDBAG_MOD; 555 new->action = SNAC_SUBTYPE_FEEDBAG_MOD;
556 new->ack = 0xffff; 556 new->ack = 0xffff;
557 new->name = NULL; 557 new->name = NULL;
558 new->item = cur1; 558 new->item = cur1;
559 new->next = NULL; 559 new->next = NULL;
607 607
608 cur = od->ssi.official; 608 cur = od->ssi.official;
609 while (cur) { 609 while (cur) {
610 del = cur; 610 del = cur;
611 cur = cur->next; 611 cur = cur->next;
612 free(del->name); 612 g_free(del->name);
613 aim_tlvlist_free(&del->data); 613 aim_tlvlist_free(&del->data);
614 free(del); 614 g_free(del);
615 } 615 }
616 616
617 cur = od->ssi.local; 617 cur = od->ssi.local;
618 while (cur) { 618 while (cur) {
619 del = cur; 619 del = cur;
620 cur = cur->next; 620 cur = cur->next;
621 free(del->name); 621 g_free(del->name);
622 aim_tlvlist_free(&del->data); 622 aim_tlvlist_free(&del->data);
623 free(del); 623 g_free(del);
624 } 624 }
625 625
626 curtmp = od->ssi.pending; 626 curtmp = od->ssi.pending;
627 while (curtmp) { 627 while (curtmp) {
628 deltmp = curtmp; 628 deltmp = curtmp;
629 curtmp = curtmp->next; 629 curtmp = curtmp->next;
630 free(deltmp); 630 g_free(deltmp);
631 } 631 }
632 632
633 od->ssi.numitems = 0; 633 od->ssi.numitems = 0;
634 od->ssi.official = NULL; 634 od->ssi.official = NULL;
635 od->ssi.local = NULL; 635 od->ssi.local = NULL;
670 aim_ssi_deldeny(od, NULL); 670 aim_ssi_deldeny(od, NULL);
671 } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(od->ssi.local, cur->gid, 0x0000)))) { 671 } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(od->ssi.local, cur->gid, 0x0000)))) {
672 char *alias = aim_ssi_getalias(od->ssi.local, NULL, cur->name); 672 char *alias = aim_ssi_getalias(od->ssi.local, NULL, cur->name);
673 aim_ssi_addbuddy(od, cur->name, "orphans", alias, NULL, NULL, 0); 673 aim_ssi_addbuddy(od, cur->name, "orphans", alias, NULL, NULL, 0);
674 aim_ssi_delbuddy(od, cur->name, NULL); 674 aim_ssi_delbuddy(od, cur->name, NULL);
675 free(alias); 675 g_free(alias);
676 } 676 }
677 cur = next; 677 cur = next;
678 } 678 }
679 679
680 /* Make sure there aren't any duplicate buddies in a group, or duplicate permits or denies */ 680 /* Make sure there aren't any duplicate buddies in a group, or duplicate permits or denies */
927 waitingforauth = aim_ssi_waitingforauth(od->ssi.local, oldgn, sn); 927 waitingforauth = aim_ssi_waitingforauth(od->ssi.local, oldgn, sn);
928 928
929 aim_ssi_delbuddy(od, sn, oldgn); 929 aim_ssi_delbuddy(od, sn, oldgn);
930 aim_ssi_addbuddy(od, sn, newgn, alias, NULL, NULL, waitingforauth); 930 aim_ssi_addbuddy(od, sn, newgn, alias, NULL, NULL, waitingforauth);
931 931
932 free(alias); 932 g_free(alias);
933 933
934 return 0; 934 return 0;
935 } 935 }
936 936
937 /** 937 /**
1010 return -EINVAL; 1010 return -EINVAL;
1011 1011
1012 if (!(group = aim_ssi_itemlist_finditem(od->ssi.local, oldgn, NULL, AIM_SSI_TYPE_GROUP))) 1012 if (!(group = aim_ssi_itemlist_finditem(od->ssi.local, oldgn, NULL, AIM_SSI_TYPE_GROUP)))
1013 return -EINVAL; 1013 return -EINVAL;
1014 1014
1015 free(group->name); 1015 g_free(group->name);
1016 group->name = (char *)malloc((strlen(newgn)+1)*sizeof(char)); 1016 group->name = (char *)g_malloc((strlen(newgn)+1)*sizeof(char));
1017 strcpy(group->name, newgn); 1017 strcpy(group->name, newgn);
1018 1018
1019 /* Sync our local list with the server list */ 1019 /* Sync our local list with the server list */
1020 return aim_ssi_sync(od); 1020 return aim_ssi_sync(od);
1021 } 1021 }
1084 1084
1085 tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, NULL); 1085 tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, NULL);
1086 } 1086 }
1087 1087
1088 /* Need to add the 0x00d5 TLV to the TLV chain */ 1088 /* Need to add the 0x00d5 TLV to the TLV chain */
1089 csumdata = (guint8 *)malloc((iconsumlen+2)*sizeof(guint8)); 1089 csumdata = (guint8 *)g_malloc((iconsumlen+2)*sizeof(guint8));
1090 aimutil_put8(&csumdata[0], 0x00); 1090 aimutil_put8(&csumdata[0], 0x00);
1091 aimutil_put8(&csumdata[1], iconsumlen); 1091 aimutil_put8(&csumdata[1], iconsumlen);
1092 memcpy(&csumdata[2], iconsum, iconsumlen); 1092 memcpy(&csumdata[2], iconsum, iconsumlen);
1093 aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(guint8), csumdata); 1093 aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(guint8), csumdata);
1094 free(csumdata); 1094 g_free(csumdata);
1095 1095
1096 /* Need to add the 0x0131 TLV to the TLV chain, used to cache the icon */ 1096 /* Need to add the 0x0131 TLV to the TLV chain, used to cache the icon */
1097 aim_tlvlist_replace_noval(&tmp->data, 0x0131); 1097 aim_tlvlist_replace_noval(&tmp->data, 0x0131);
1098 1098
1099 /* Sync our local list with the server list */ 1099 /* Sync our local list with the server list */
1186 return 0; 1186 return 0;
1187 } 1187 }
1188 1188
1189 byte_stream_init(&bstream, tlv->value, tlv->length); 1189 byte_stream_init(&bstream, tlv->value, tlv->length);
1190 1190
1191 maxitems = (guint16 *)malloc((tlv->length/2)*sizeof(guint16)); 1191 maxitems = (guint16 *)g_malloc((tlv->length/2)*sizeof(guint16));
1192 1192
1193 for (i=0; i<(tlv->length/2); i++) 1193 for (i=0; i<(tlv->length/2); i++)
1194 maxitems[i] = byte_stream_get16(&bstream); 1194 maxitems[i] = byte_stream_get16(&bstream);
1195 1195
1196 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) 1196 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
1197 ret = userfunc(od, conn, frame, tlv->length/2, maxitems); 1197 ret = userfunc(od, conn, frame, tlv->length/2, maxitems);
1198 1198
1199 aim_tlvlist_free(&tlvlist); 1199 aim_tlvlist_free(&tlvlist);
1200 free(maxitems); 1200 g_free(maxitems);
1201 1201
1202 return ret; 1202 return ret;
1203 } 1203 }
1204 1204
1205 /* 1205 /*
1281 gid = byte_stream_get16(bs); 1281 gid = byte_stream_get16(bs);
1282 bid = byte_stream_get16(bs); 1282 bid = byte_stream_get16(bs);
1283 type = byte_stream_get16(bs); 1283 type = byte_stream_get16(bs);
1284 data = aim_tlvlist_readlen(bs, byte_stream_get16(bs)); 1284 data = aim_tlvlist_readlen(bs, byte_stream_get16(bs));
1285 aim_ssi_itemlist_add(&od->ssi.official, name, gid, bid, type, data); 1285 aim_ssi_itemlist_add(&od->ssi.official, name, gid, bid, type, data);
1286 free(name); 1286 g_free(name);
1287 aim_tlvlist_free(&data); 1287 aim_tlvlist_free(&data);
1288 } 1288 }
1289 1289
1290 /* Read in the timestamp */ 1290 /* Read in the timestamp */
1291 od->ssi.timestamp = byte_stream_get32(bs); 1291 od->ssi.timestamp = byte_stream_get32(bs);
1409 aim_tlvlist_free(&data); 1409 aim_tlvlist_free(&data);
1410 1410
1411 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) 1411 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
1412 ret = userfunc(od, conn, frame, type, name); 1412 ret = userfunc(od, conn, frame, type, name);
1413 1413
1414 free(name); 1414 g_free(name);
1415 } 1415 }
1416 1416
1417 return ret; 1417 return ret;
1418 } 1418 }
1419 1419
1445 data = NULL; 1445 data = NULL;
1446 1446
1447 /* Replace the 2 local items with the given one */ 1447 /* Replace the 2 local items with the given one */
1448 if ((item = aim_ssi_itemlist_find(od->ssi.local, gid, bid))) { 1448 if ((item = aim_ssi_itemlist_find(od->ssi.local, gid, bid))) {
1449 item->type = type; 1449 item->type = type;
1450 free(item->name); 1450 g_free(item->name);
1451 if (name) { 1451 if (name) {
1452 item->name = (char *)malloc((strlen(name)+1)*sizeof(char)); 1452 item->name = (char *)g_malloc((strlen(name)+1)*sizeof(char));
1453 strcpy(item->name, name); 1453 strcpy(item->name, name);
1454 } else 1454 } else
1455 item->name = NULL; 1455 item->name = NULL;
1456 aim_tlvlist_free(&item->data); 1456 aim_tlvlist_free(&item->data);
1457 item->data = aim_tlvlist_copy(data); 1457 item->data = aim_tlvlist_copy(data);
1458 } 1458 }
1459 1459
1460 if ((item = aim_ssi_itemlist_find(od->ssi.official, gid, bid))) { 1460 if ((item = aim_ssi_itemlist_find(od->ssi.official, gid, bid))) {
1461 item->type = type; 1461 item->type = type;
1462 free(item->name); 1462 g_free(item->name);
1463 if (name) { 1463 if (name) {
1464 item->name = (char *)malloc((strlen(name)+1)*sizeof(char)); 1464 item->name = (char *)g_malloc((strlen(name)+1)*sizeof(char));
1465 strcpy(item->name, name); 1465 strcpy(item->name, name);
1466 } else 1466 } else
1467 item->name = NULL; 1467 item->name = NULL;
1468 aim_tlvlist_free(&item->data); 1468 aim_tlvlist_free(&item->data);
1469 item->data = aim_tlvlist_copy(data); 1469 item->data = aim_tlvlist_copy(data);
1470 } 1470 }
1471 1471
1472 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) 1472 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
1473 ret = userfunc(od, conn, frame); 1473 ret = userfunc(od, conn, frame);
1474 1474
1475 free(name); 1475 g_free(name);
1476 aim_tlvlist_free(&data); 1476 aim_tlvlist_free(&data);
1477 } 1477 }
1478 1478
1479 return ret; 1479 return ret;
1480 } 1480 }
1541 if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) { 1541 if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) {
1542 /* Remove the item from the local list */ 1542 /* Remove the item from the local list */
1543 /* Make sure cur->item is still valid memory */ 1543 /* Make sure cur->item is still valid memory */
1544 if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { 1544 if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) {
1545 if (cur->item->name) { 1545 if (cur->item->name) {
1546 cur->name = (char *)malloc((strlen(cur->item->name)+1)*sizeof(char)); 1546 cur->name = (char *)g_malloc((strlen(cur->item->name)+1)*sizeof(char));
1547 strcpy(cur->name, cur->item->name); 1547 strcpy(cur->name, cur->item->name);
1548 } 1548 }
1549 aim_ssi_itemlist_del(&od->ssi.local, cur->item); 1549 aim_ssi_itemlist_del(&od->ssi.local, cur->item);
1550 } 1550 }
1551 cur->item = NULL; 1551 cur->item = NULL;
1553 } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { 1553 } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) {
1554 /* Replace the local item with the item from the official list */ 1554 /* Replace the local item with the item from the official list */
1555 if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { 1555 if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) {
1556 struct aim_ssi_item *cur1; 1556 struct aim_ssi_item *cur1;
1557 if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) { 1557 if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) {
1558 free(cur->item->name); 1558 g_free(cur->item->name);
1559 if (cur1->name) { 1559 if (cur1->name) {
1560 cur->item->name = (char *)malloc((strlen(cur1->name)+1)*sizeof(char)); 1560 cur->item->name = (char *)g_malloc((strlen(cur1->name)+1)*sizeof(char));
1561 strcpy(cur->item->name, cur1->name); 1561 strcpy(cur->item->name, cur1->name);
1562 } else 1562 } else
1563 cur->item->name = NULL; 1563 cur->item->name = NULL;
1564 aim_tlvlist_free(&cur->item->data); 1564 aim_tlvlist_free(&cur->item->data);
1565 cur->item->data = aim_tlvlist_copy(cur1->data); 1565 cur->item->data = aim_tlvlist_copy(cur1->data);
1587 } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { 1587 } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) {
1588 /* Replace the official item with the item from the local list */ 1588 /* Replace the official item with the item from the local list */
1589 if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { 1589 if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) {
1590 struct aim_ssi_item *cur1; 1590 struct aim_ssi_item *cur1;
1591 if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) { 1591 if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) {
1592 free(cur1->name); 1592 g_free(cur1->name);
1593 if (cur->item->name) { 1593 if (cur->item->name) {
1594 cur1->name = (char *)malloc((strlen(cur->item->name)+1)*sizeof(char)); 1594 cur1->name = (char *)g_malloc((strlen(cur->item->name)+1)*sizeof(char));
1595 strcpy(cur1->name, cur->item->name); 1595 strcpy(cur1->name, cur->item->name);
1596 } else 1596 } else
1597 cur1->name = NULL; 1597 cur1->name = NULL;
1598 aim_tlvlist_free(&cur1->data); 1598 aim_tlvlist_free(&cur1->data);
1599 cur1->data = aim_tlvlist_copy(cur->item->data); 1599 cur1->data = aim_tlvlist_copy(cur->item->data);
1618 /* Free all aim_ssi_tmp's with an outcome */ 1618 /* Free all aim_ssi_tmp's with an outcome */
1619 cur = od->ssi.pending; 1619 cur = od->ssi.pending;
1620 while (cur && (cur->ack != 0xffff)) { 1620 while (cur && (cur->ack != 0xffff)) {
1621 del = cur; 1621 del = cur;
1622 cur = cur->next; 1622 cur = cur->next;
1623 free(del->name); 1623 g_free(del->name);
1624 free(del); 1624 g_free(del);
1625 } 1625 }
1626 od->ssi.pending = cur; 1626 od->ssi.pending = cur;
1627 1627
1628 /* If we're not waiting for any more acks, then send more SNACs */ 1628 /* If we're not waiting for any more acks, then send more SNACs */
1629 if (!od->ssi.pending) { 1629 if (!od->ssi.pending) {
1755 tmp = byte_stream_get16(bs); 1755 tmp = byte_stream_get16(bs);
1756 1756
1757 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) 1757 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
1758 ret = userfunc(od, conn, frame, sn, msg); 1758 ret = userfunc(od, conn, frame, sn, msg);
1759 1759
1760 free(sn); 1760 g_free(sn);
1761 free(msg); 1761 g_free(msg);
1762 1762
1763 return ret; 1763 return ret;
1764 } 1764 }
1765 1765
1766 /* 1766 /*
1829 tmp = byte_stream_get16(bs); 1829 tmp = byte_stream_get16(bs);
1830 1830
1831 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) 1831 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
1832 ret = userfunc(od, conn, frame, sn, msg); 1832 ret = userfunc(od, conn, frame, sn, msg);
1833 1833
1834 free(sn); 1834 g_free(sn);
1835 free(msg); 1835 g_free(msg);
1836 1836
1837 return ret; 1837 return ret;
1838 } 1838 }
1839 1839
1840 /* 1840 /*
1916 tmp = byte_stream_get16(bs); 1916 tmp = byte_stream_get16(bs);
1917 1917
1918 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) 1918 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
1919 ret = userfunc(od, conn, frame, sn, reply, msg); 1919 ret = userfunc(od, conn, frame, sn, reply, msg);
1920 1920
1921 free(sn); 1921 g_free(sn);
1922 free(msg); 1922 g_free(msg);
1923 1923
1924 return ret; 1924 return ret;
1925 } 1925 }
1926 1926
1927 /* 1927 /*
1941 sn = NULL; 1941 sn = NULL;
1942 1942
1943 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) 1943 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
1944 ret = userfunc(od, conn, frame, sn); 1944 ret = userfunc(od, conn, frame, sn);
1945 1945
1946 free(sn); 1946 g_free(sn);
1947 1947
1948 return ret; 1948 return ret;
1949 } 1949 }
1950 1950
1951 static int 1951 static int