comparison 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
comparison
equal deleted inserted replaced
24798:a8643ca8d2e0 24799:c044eb54b7ac
110 * 110 *
111 * _uid_field_name: string, name of field to add with userid from userinfo message 111 * _uid_field_name: string, name of field to add with userid from userinfo message
112 * _uid_before: string, name of field before field to insert, or NULL for end 112 * _uid_before: string, name of field before field to insert, or NULL for end
113 */ 113 */
114 static void 114 static void
115 msim_postprocess_outgoing_cb(MsimSession *session, MsimMessage *userinfo, 115 msim_postprocess_outgoing_cb(MsimSession *session, const MsimMessage *userinfo,
116 gpointer data) 116 gpointer data)
117 { 117 {
118 gchar *uid_field_name, *uid_before, *username; 118 gchar *uid_field_name, *uid_before, *username;
119 guint uid; 119 guint uid;
120 MsimMessage *msg, *body; 120 MsimMessage *msg, *body;
827 827
828 /** 828 /**
829 * Handle mail reply checks. 829 * Handle mail reply checks.
830 */ 830 */
831 static void 831 static void
832 msim_check_inbox_cb(MsimSession *session, MsimMessage *reply, gpointer data) 832 msim_check_inbox_cb(MsimSession *session, const MsimMessage *reply, gpointer data)
833 { 833 {
834 MsimMessage *body; 834 MsimMessage *body;
835 guint old_inbox_status; 835 guint old_inbox_status;
836 guint i, n; 836 guint i, n;
837 const gchar *froms[5], *tos[5], *urls[5], *subjects[5]; 837 const gchar *froms[5], *tos[5], *urls[5], *subjects[5];
956 * Callback from msim_add_contact_from_server(). 956 * Callback from msim_add_contact_from_server().
957 * 957 *
958 * @param data An MsimMessage * of the contact information. Will be freed. 958 * @param data An MsimMessage * of the contact information. Will be freed.
959 */ 959 */
960 static void 960 static void
961 msim_add_contact_from_server_cb(MsimSession *session, MsimMessage *user_lookup_info, gpointer data) 961 msim_add_contact_from_server_cb(MsimSession *session, const MsimMessage *user_lookup_info, gpointer data)
962 { 962 {
963 MsimMessage *contact_info, *user_lookup_info_body; 963 MsimMessage *contact_info, *user_lookup_info_body;
964 PurpleGroup *group; 964 PurpleGroup *group;
965 PurpleBuddy *buddy; 965 PurpleBuddy *buddy;
966 MsimUser *user; 966 MsimUser *user;
1092 1092
1093 /** 1093 /**
1094 * Called when contact list is received from server. 1094 * Called when contact list is received from server.
1095 */ 1095 */
1096 static void 1096 static void
1097 msim_got_contact_list(MsimSession *session, MsimMessage *reply, gpointer user_data) 1097 msim_got_contact_list(MsimSession *session, const MsimMessage *reply, gpointer user_data)
1098 { 1098 {
1099 MsimMessage *body, *body_node; 1099 MsimMessage *body, *body_node;
1100 gchar *msg; 1100 gchar *msg;
1101 guint buddy_count; 1101 guint buddy_count;
1102 1102
1765 data = g_hash_table_lookup(session->user_lookup_cb_data, GUINT_TO_POINTER(rid)); 1765 data = g_hash_table_lookup(session->user_lookup_cb_data, GUINT_TO_POINTER(rid));
1766 1766
1767 if (cb) { 1767 if (cb) {
1768 purple_debug_info("msim", "msim_process_reply: calling callback now\n"); 1768 purple_debug_info("msim", "msim_process_reply: calling callback now\n");
1769 /* Clone message, so that the callback 'cb' can use it (needs to free it also). */ 1769 /* Clone message, so that the callback 'cb' can use it (needs to free it also). */
1770 cb(session, msim_msg_clone(msg), data); 1770 cb(session, msg, data);
1771 g_hash_table_remove(session->user_lookup_cb, GUINT_TO_POINTER(rid)); 1771 g_hash_table_remove(session->user_lookup_cb, GUINT_TO_POINTER(rid));
1772 g_hash_table_remove(session->user_lookup_cb_data, GUINT_TO_POINTER(rid)); 1772 g_hash_table_remove(session->user_lookup_cb_data, GUINT_TO_POINTER(rid));
1773 } else { 1773 } else {
1774 purple_debug_info("msim", 1774 purple_debug_info("msim",
1775 "msim_process_reply: no callback for rid %d\n", rid); 1775 "msim_process_reply: no callback for rid %d\n", rid);
1896 * @param session 1896 * @param session
1897 * @param userinfo Response messsage to resolving request. 1897 * @param userinfo Response messsage to resolving request.
1898 * @param data MsimMessage *, the message to attach information to. 1898 * @param data MsimMessage *, the message to attach information to.
1899 */ 1899 */
1900 static void 1900 static void
1901 msim_incoming_resolved(MsimSession *session, MsimMessage *userinfo, 1901 msim_incoming_resolved(MsimSession *session, const MsimMessage *userinfo,
1902 gpointer data) 1902 gpointer data)
1903 { 1903 {
1904 gchar *username; 1904 gchar *username;
1905 MsimMessage *msg, *body; 1905 MsimMessage *msg, *body;
1906 1906
2338 2338
2339 /** 2339 /**
2340 * Callback for msim_get_info(), for when user info is received. 2340 * Callback for msim_get_info(), for when user info is received.
2341 */ 2341 */
2342 static void 2342 static void
2343 msim_get_info_cb(MsimSession *session, MsimMessage *user_info_msg, 2343 msim_get_info_cb(MsimSession *session, const MsimMessage *user_info_msg,
2344 gpointer data) 2344 gpointer data)
2345 { 2345 {
2346 MsimMessage *msg; 2346 MsimMessage *msg;
2347 gchar *username; 2347 gchar *username;
2348 PurpleNotifyUserInfo *user_info; 2348 PurpleNotifyUserInfo *user_info;
3085 3085
3086 /** 3086 /**
3087 * Called when friends have been imported to buddy list on server. 3087 * Called when friends have been imported to buddy list on server.
3088 */ 3088 */
3089 static void 3089 static void
3090 msim_import_friends_cb(MsimSession *session, MsimMessage *reply, gpointer user_data) 3090 msim_import_friends_cb(MsimSession *session, const MsimMessage *reply, gpointer user_data)
3091 { 3091 {
3092 MsimMessage *body; 3092 MsimMessage *body;
3093 gchar *completed; 3093 gchar *completed;
3094 3094
3095 /* Check if the friends were imported successfully. */ 3095 /* Check if the friends were imported successfully. */