diff libpurple/protocols/yahoo/yahoo_friend.c @ 22807:0b11895cc564

Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 03 May 2008 21:03:13 +0000
parents 44b4e8bd759b
children f16aba67b685
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo_friend.c	Sat May 03 19:45:15 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_friend.c	Sat May 03 21:03:13 2008 +0000
@@ -76,8 +76,7 @@
 
 void yahoo_friend_set_ip(YahooFriend *f, const char *ip)
 {
-	if (f->ip)
-		g_free(f->ip);
+	g_free(f->ip);
 	f->ip = g_strdup(ip);
 }
 
@@ -88,8 +87,7 @@
 
 void yahoo_friend_set_game(YahooFriend *f, const char *game)
 {
-	if (f->game)
-		g_free(f->game);
+	g_free(f->game);
 
 	if (game)
 		f->game = g_strdup(game);
@@ -104,8 +102,7 @@
 
 void yahoo_friend_set_status_message(YahooFriend *f, char *msg)
 {
-	if (f->msg)
-		g_free(f->msg);
+	g_free(f->msg);
 
 	f->msg = msg;
 }
@@ -125,15 +122,24 @@
 	return !f->bicon_sent_request;
 }
 
+void yahoo_friend_set_alias_id(YahooFriend *f, const char *alias_id)
+{
+	g_free(f->alias_id);
+	f->alias_id = g_strdup(alias_id);
+}
+
+const char *yahoo_friend_get_alias_id(YahooFriend *f)
+{
+	return f->alias_id;
+}
+
 void yahoo_friend_free(gpointer p)
 {
 	YahooFriend *f = p;
-	if (f->msg)
-		g_free(f->msg);
-	if (f->game)
-		g_free(f->game);
-	if (f->ip)
-		g_free(f->ip);
+	g_free(f->msg);
+	g_free(f->game);
+	g_free(f->ip);
+	g_free(f->alias_id);
 	g_free(f);
 }