diff libpurple/protocols/yahoo/yahoo_filexfer.c @ 26634:4bac03b3c0fd

Free the DNS query data before purple_url_parse() to avoid leaking on failure.
author Paul Aurich <paul@darkrain42.org>
date Sun, 12 Apr 2009 22:25:56 +0000
parents 98d8c336234d
children fac90dbe196d b623c1824f29
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Sun Apr 12 22:23:34 2009 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Sun Apr 12 22:25:56 2009 +0000
@@ -1029,12 +1029,7 @@
 		xd->port = YAHOO_XFER_RELAY_PORT;
 
 	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);
+
 	/* Free the address... */
 	g_free(hosts->data);
 	hosts = g_slist_remove(hosts, hosts->data);
@@ -1048,6 +1043,13 @@
 		hosts = g_slist_remove(hosts, hosts->data);
 	}
 
+	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);
+
 	pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id);
 	filename = g_path_get_basename(purple_xfer_get_local_filename(xfer));