diff libpurple/protocols/myspace/myspace.c @ 24799: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 a8643ca8d2e0
children 759dbafdc74a
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Wed Dec 17 18:36:31 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Wed Dec 17 20:50:49 2008 +0000
@@ -112,7 +112,7 @@
  *  _uid_before: string, name of field before field to insert, or NULL for end
  */
 static void
-msim_postprocess_outgoing_cb(MsimSession *session, MsimMessage *userinfo,
+msim_postprocess_outgoing_cb(MsimSession *session, const MsimMessage *userinfo,
 		gpointer data)
 {
 	gchar *uid_field_name, *uid_before, *username;
@@ -829,7 +829,7 @@
  * Handle mail reply checks.
  */
 static void
-msim_check_inbox_cb(MsimSession *session, MsimMessage *reply, gpointer data)
+msim_check_inbox_cb(MsimSession *session, const MsimMessage *reply, gpointer data)
 {
 	MsimMessage *body;
 	guint old_inbox_status;
@@ -958,7 +958,7 @@
  * @param data An MsimMessage * of the contact information. Will be freed.
  */
 static void
-msim_add_contact_from_server_cb(MsimSession *session, MsimMessage *user_lookup_info, gpointer data)
+msim_add_contact_from_server_cb(MsimSession *session, const MsimMessage *user_lookup_info, gpointer data)
 {
 	MsimMessage *contact_info, *user_lookup_info_body;
 	PurpleGroup *group;
@@ -1094,7 +1094,7 @@
  * Called when contact list is received from server.
  */
 static void
-msim_got_contact_list(MsimSession *session, MsimMessage *reply, gpointer user_data)
+msim_got_contact_list(MsimSession *session, const MsimMessage *reply, gpointer user_data)
 {
 	MsimMessage *body, *body_node;
 	gchar *msg;
@@ -1767,7 +1767,7 @@
 	if (cb) {
 		purple_debug_info("msim", "msim_process_reply: calling callback now\n");
 		/* Clone message, so that the callback 'cb' can use it (needs to free it also). */
-		cb(session, msim_msg_clone(msg), data);
+		cb(session, msg, data);
 		g_hash_table_remove(session->user_lookup_cb, GUINT_TO_POINTER(rid));
 		g_hash_table_remove(session->user_lookup_cb_data, GUINT_TO_POINTER(rid));
 	} else {
@@ -1898,7 +1898,7 @@
  * @param data MsimMessage *, the message to attach information to.
  */
 static void
-msim_incoming_resolved(MsimSession *session, MsimMessage *userinfo,
+msim_incoming_resolved(MsimSession *session, const MsimMessage *userinfo,
 		gpointer data)
 {
 	gchar *username;
@@ -2340,7 +2340,7 @@
  * Callback for msim_get_info(), for when user info is received.
  */
 static void
-msim_get_info_cb(MsimSession *session, MsimMessage *user_info_msg,
+msim_get_info_cb(MsimSession *session, const MsimMessage *user_info_msg,
 		gpointer data)
 {
 	MsimMessage *msg;
@@ -3087,7 +3087,7 @@
  * Called when friends have been imported to buddy list on server.
  */
 static void
-msim_import_friends_cb(MsimSession *session, MsimMessage *reply, gpointer user_data)
+msim_import_friends_cb(MsimSession *session, const MsimMessage *reply, gpointer user_data)
 {
 	MsimMessage *body;
 	gchar *completed;