changeset 22794:0d7ceae153bd

Leak fixes.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 02 May 2008 22:01:01 +0000
parents 6b182ab4bc05
children 42dfa1139b5c
files libpurple/protocols/yahoo/yahoo_aliases.c libpurple/protocols/yahoo/yahoo_filexfer.c
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo_aliases.c	Fri May 02 21:09:59 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_aliases.c	Fri May 02 22:01:01 2008 +0000
@@ -68,7 +68,8 @@
 		purple_debug_info("yahoo", "No Aliases to process.%s%s\n",
 						  error_message ? " Error:" : "", error_message ? error_message : "");
 	} else {
-		const char *yid, *full_name, *nick_name, *alias, *id, *fn, *ln, *nn;
+		gchar *full_name, *nick_name, *alias;
+		const char *yid, *id, *fn, *ln, *nn;
 		PurpleBuddy *b = NULL;
 		xmlnode *item, *contacts;
 
@@ -92,7 +93,9 @@
 				nn = xmlnode_get_attrib(item,"nn");
 				id = xmlnode_get_attrib(item,"id");
 
-		                /* Yahoo stores first and last names separately, lets put them together into a full name */
+				full_name = nick_name = alias = NULL;
+
+				/* Yahoo stores first and last names separately, lets put them together into a full name */
 				if (yd->jp)
 					full_name = g_strstrip(g_strdup_printf("%s %s", (ln != NULL ? ln : "") , (fn != NULL ? fn : "")));
 				else
@@ -103,8 +106,6 @@
 					alias = nick_name;   /* If we have a nickname from Yahoo, let's use it */
 				else if (strlen(full_name) != 0)
 					alias = full_name;  /* If no Yahoo nickname, we can use the full_name created above */
-				else
-					alias = NULL;  /* No nickname, first name or last name, then you get no alias !!  */
 
 				/*  Find the local buddy that matches */
 				b = purple_find_buddy(cb->gc->account, yid);
@@ -118,6 +119,7 @@
 					yu->firstname = g_strdup(fn);
 					yu->lastname = g_strdup(ln);
 					yu->nickname = g_strdup(nn);
+					/* TODO: Isn't there a possiblity that b->proto_data is already set? */
 					b->proto_data=yu;
 
 					/* Finally, if we received an alias, we better update the buddy list */
@@ -132,6 +134,9 @@
 				} else {
 					purple_debug_info("yahoo", "Bizarre, received alias for %s, but they are not on your list...\n", yid);
 				}
+
+				g_free(full_name);
+				g_free(nick_name);
 			}
 		}
 		xmlnode_free(contacts);
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Fri May 02 21:09:59 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Fri May 02 22:01:01 2008 +0000
@@ -998,6 +998,7 @@
 	url = g_strdup_printf("%ld.%ld.%ld.%ld", d, c, b, a);
 	if (!purple_url_parse(url, &(xd->host), &(xd->port), &(xd->path), NULL, NULL)) {
 		purple_xfer_cancel_remote(xfer);
+		g_free(url);
 		return;
 	}
 	g_free(url);