/pidgin/main: 57f67d15a87d: Add memleak fixup to Yahoo prpl afte...

Eion Robb eionrobb at gmail.com
Sat Jan 23 14:06:34 EST 2016


Changeset: 57f67d15a87d224d3f4adabd4bf136a584aa5e68
Author:	 Eion Robb <eionrobb at gmail.com>
Date:	 2016-01-21 21:12 +1300
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/57f67d15a87d

Description:

Add memleak fixup to Yahoo prpl after cookie getter API change

diffstat:

 libpurple/protocols/yahoo/ymsg.c |  20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diffs (49 lines):

diff --git a/libpurple/protocols/yahoo/ymsg.c b/libpurple/protocols/yahoo/ymsg.c
--- a/libpurple/protocols/yahoo/ymsg.c
+++ b/libpurple/protocols/yahoo/ymsg.c
@@ -1705,9 +1705,9 @@ static void yahoo_auth16_stage2(PurpleHt
 		"\r\n", -1);
 
 	cookiejar = purple_http_conn_get_cookie_jar(http_conn);
-	yd->cookie_b = g_strdup(purple_http_cookie_jar_get(cookiejar, "B"));
-	yd->cookie_t = g_strdup(purple_http_cookie_jar_get(cookiejar, "T"));
-	yd->cookie_y = g_strdup(purple_http_cookie_jar_get(cookiejar, "Y"));
+	yd->cookie_b = purple_http_cookie_jar_get(cookiejar, "B");
+	yd->cookie_t = purple_http_cookie_jar_get(cookiejar, "T");
+	yd->cookie_y = purple_http_cookie_jar_get(cookiejar, "Y");
 
 	i = 0;
 	while (splits[i]) {
@@ -3214,7 +3214,7 @@ yahoo_login_page_got(PurpleHttpConnectio
 	PurpleAccount *account = purple_connection_get_account(gc);
 	PurpleHttpCookieJar *cjar;
 	GString *auth_s;
-	const gchar *cookie;
+	gchar *cookie;
 
 	if (purple_http_response_get_code(resp) != 302) {
 		purple_connection_error(gc,
@@ -3226,14 +3226,20 @@ yahoo_login_page_got(PurpleHttpConnectio
 	auth_s = g_string_new(NULL);
 	cjar = purple_http_conn_get_cookie_jar(hc);
 	cookie = purple_http_cookie_jar_get(cjar, "B");
-	if (cookie)
+	if (cookie) {
 		g_string_append_printf(auth_s, "B=%s; ", cookie);
+		g_free(cookie);
+	}
 	cookie = purple_http_cookie_jar_get(cjar, "T");
-	if (cookie)
+	if (cookie) {
 		g_string_append_printf(auth_s, "T=%s; ", cookie);
+		g_free(cookie);
+	}
 	cookie = purple_http_cookie_jar_get(cjar, "Y");
-	if (cookie)
+	if (cookie) {
 		g_string_append_printf(auth_s, "Y=%s; ", cookie);
+		g_free(cookie);
+	}
 
 	yd->auth = g_string_free(auth_s, FALSE);
 	/* Now we have our cookies to login with.  I'll go get the milk. */



More information about the Commits mailing list