comparison libpurple/protocols/yahoo/libymsg.c @ 28162:44930be7114b

Fix two memory leaks. We were setting norm_bud and temp to NULL without freeing them first. I'm guessing this wasn't severe, but I didn't really look at what this code does.
author Mark Doliner <mark@kingant.net>
date Tue, 04 Aug 2009 08:14:41 +0000
parents da33da2e1a1e
children 90b471ba5282
comparison
equal deleted inserted replaced
28161:79630bfee621 28162:44930be7114b
476 GSList *l = pkt->hash; 476 GSList *l = pkt->hash;
477 477
478 PurpleAccount *account = purple_connection_get_account(gc); 478 PurpleAccount *account = purple_connection_get_account(gc);
479 YahooData *yd = gc->proto_data; 479 YahooData *yd = gc->proto_data;
480 GHashTable *ht; 480 GHashTable *ht;
481 char *norm_bud = NULL; 481 char *norm_bud;
482 char *temp = NULL; 482 char *temp = NULL;
483 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ 483 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */
484 /* But what if you had no friends? */ 484 /* But what if you had no friends? */
485 PurpleBuddy *b; 485 PurpleBuddy *b;
486 PurpleGroup *g; 486 PurpleGroup *g;
487 int protocol = 0; 487 int protocol = 0;
488 int stealth = 0; 488 int stealth = 0;
489
490 489
491 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); 490 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
492 491
493 while (l) { 492 while (l) {
494 struct yahoo_pair *pair = l->data; 493 struct yahoo_pair *pair = l->data;
544 /* This buddy is on the ignore list (and therefore in no group) */ 543 /* This buddy is on the ignore list (and therefore in no group) */
545 purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud); 544 purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud);
546 purple_privacy_deny_add(account, norm_bud, 1); 545 purple_privacy_deny_add(account, norm_bud, 1);
547 } 546 }
548 547
548 g_free(norm_bud);
549
549 protocol = 0; 550 protocol = 0;
550 stealth = 0; 551 stealth = 0;
551 norm_bud = NULL; 552 g_free(temp);
552 temp = NULL; 553 temp = NULL;
553 } 554 }
554 break; 555 break;
555 case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */ 556 case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */
556 break; 557 break;
557 case 65: /* This is the group */ 558 case 65: /* This is the group */
558 g_free(yd->current_list15_grp); 559 g_free(yd->current_list15_grp);
559 yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE); 560 yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE);
560 break; 561 break;
561 case 7: /* buddy's s/n */ 562 case 7: /* buddy's s/n */
563 g_free(temp);
562 temp = g_strdup(purple_normalize(account, pair->value)); 564 temp = g_strdup(purple_normalize(account, pair->value));
563 break; 565 break;
564 case 241: /* another protocol user */ 566 case 241: /* another protocol user */
565 protocol = strtol(pair->value, NULL, 10); 567 protocol = strtol(pair->value, NULL, 10);
566 break; 568 break;
592 yd->picture_upload_todo = NULL; 594 yd->picture_upload_todo = NULL;
593 } 595 }
594 yahoo_set_status(account, purple_account_get_active_status(account)); 596 yahoo_set_status(account, purple_account_get_active_status(account));
595 597
596 g_hash_table_destroy(ht); 598 g_hash_table_destroy(ht);
597 g_free(norm_bud);
598 g_free(temp); 599 g_free(temp);
599 } 600 }
600 601
601 static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) 602 static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt)
602 { 603 {