diff libpurple/protocols/myspace/user.c @ 24764:c044eb54b7ac

Fix a leak in myspace prpl. In myspace.c:msim_process_reply, the clone of 'msg' sent to the callbacks were never freed. Also, do not unnecessarily dup a static string (which needs to be marked for translation after the string freeze).
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 17 Dec 2008 20:50:49 +0000
parents 8e75a1525156
children 22fd7467f0cc 47540809ae91
line wrap: on
line diff
--- a/libpurple/protocols/myspace/user.c	Wed Dec 17 18:36:31 2008 +0000
+++ b/libpurple/protocols/myspace/user.c	Wed Dec 17 20:50:49 2008 +0000
@@ -388,7 +388,7 @@
  * is a no-op (and returns FALSE).
  */
 gboolean
-msim_store_user_info(MsimSession *session, MsimMessage *msg, MsimUser *user)
+msim_store_user_info(MsimSession *session, const MsimMessage *msg, MsimUser *user)
 {
 	gchar *username;
 	MsimMessage *body, *body_node;
@@ -592,9 +592,10 @@
 /**
  * Called after username is set.
  */
-static void msim_username_is_set_cb(MsimSession *session, MsimMessage *userinfo, gpointer data)
+static void msim_username_is_set_cb(MsimSession *session, const MsimMessage *userinfo, gpointer data)
 {
-	gchar *username, *errmsg;
+	gchar *username;
+	const gchar *errmsg;
 	MsimMessage *body;
 
 	guint rid;
@@ -610,7 +611,8 @@
 	uid = msim_msg_get_integer(userinfo, "uid");
 	lid = msim_msg_get_integer(userinfo, "lid");
 	body = msim_msg_get_dictionary(userinfo, "body");
-	errmsg = g_strdup("An error occurred while trying to set the username.\n"
+	/* XXX: Mark for translation */
+	errmsg = ("An error occurred while trying to set the username.\n"
 			"Please try again, or visit http://editprofile.myspace.com/index.cfm?"
 			"fuseaction=profile.username to set your username.");
 
@@ -667,7 +669,6 @@
 		purple_debug_info("msim","username_is_set Error: Invalid cmd/dsn/lid combination");
 		purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
 	}
-	g_free(errmsg);
 }
 
 /**
@@ -751,7 +752,7 @@
  * Now we have some real data to tell us the state of their requested username
  * \persistr\\cmd\257\dsn\5\uid\204084363\lid\7\rid\367\body\UserName=TheAlbinoRhino1\final\
  */
-static void msim_username_is_available_cb(MsimSession *session, MsimMessage *userinfo, gpointer data)
+static void msim_username_is_available_cb(MsimSession *session, const MsimMessage *userinfo, gpointer data)
 {
 	MsimMessage *msg;
 	gchar *username;