pidgin: c027d6a6: Create a string only when necessary. Fix...

sadrul at pidgin.im sadrul at pidgin.im
Sat Jun 27 05:10:55 EDT 2009


-----------------------------------------------------------------
Revision: c027d6a6b5dae34be3ecc3b6ea9ccb235fa641f8
Ancestor: 980a83f19fd18616e5450d821532def57f971e89
Author: sadrul at pidgin.im
Date: 2009-06-27T09:08:56
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c027d6a6b5dae34be3ecc3b6ea9ccb235fa641f8

Modified files:
        libpurple/protocols/yahoo/yahoo.c

ChangeLog: 

Create a string only when necessary. Fixes a small possible leak.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	dff59fca73dcd8b459863fd9ed6510acef1420eb
+++ libpurple/protocols/yahoo/yahoo.c	ab22e234c7777d6ac45dc29d64273467145e767d
@@ -745,7 +745,6 @@ static void yahoo_process_notify(PurpleC
 	gint val_11 = 0;
 	struct yahoo_data *yd = gc->proto_data;
 	gboolean msn = FALSE;
-	char *msn_from = NULL;
 
 	account = purple_connection_get_account(gc);
 
@@ -778,17 +777,16 @@ static void yahoo_process_notify(PurpleC
 		return;
 	}
 
-	if(msn)
-		msn_from = g_strconcat("msn/", from, NULL);
-
 	if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING"))
 		&& (purple_privacy_check(account, from)))
 	{
 		if(msn) {
+			char *msn_from = g_strconcat("msn/", from, NULL);
 			if (*stat == '1')
 				serv_got_typing(gc, msn_from, 0, PURPLE_TYPING);
 			else
 				serv_got_typing_stopped(gc, msn_from);
+			g_free(msn_from);
 		}
 		else	{
 			if (*stat == '1')
@@ -822,8 +820,6 @@ static void yahoo_process_notify(PurpleC
 		purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
 		g_free(buf);
 	}
-
-	g_free(msn_from);
 }
 
 


More information about the Commits mailing list