changeset 27187:52afd38e64d4

Create a string only when necessary. Fixes a small possible leak.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 27 Jun 2009 09:08:56 +0000
parents 25db53cfc12c
children a19f4b2b8143
files libpurple/protocols/yahoo/yahoo.c
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Sat Jun 27 05:45:43 2009 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Sat Jun 27 09:08:56 2009 +0000
@@ -745,7 +745,6 @@
 	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 @@
 		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 @@
 		purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
 		g_free(buf);
 	}
-
-	g_free(msn_from);
 }