diff libpurple/protocols/myspace/message.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 6b7cd5769e98
children 22fd7467f0cc
line wrap: on
line diff
--- a/libpurple/protocols/myspace/message.c	Wed Dec 17 18:36:31 2008 +0000
+++ b/libpurple/protocols/myspace/message.c	Wed Dec 17 20:50:49 2008 +0000
@@ -401,7 +401,7 @@
  *
  */
 static GList *
-msim_msg_get_node(MsimMessage *msg, const gchar *name)
+msim_msg_get_node(const MsimMessage *msg, const gchar *name)
 {
 	GList *node;
 
@@ -410,7 +410,7 @@
 	}
 
 	/* Linear search for the given name. O(n) but n is small. */
-	for (node = msg; node != NULL; node = g_list_next(node)) {
+	for (node = (GList*)msg; node != NULL; node = g_list_next(node)) {
 		MsimMessageElement *elem;
 
 		elem = (MsimMessageElement *)node->data;
@@ -1066,7 +1066,7 @@
  * another msim_msg_get_* that converts the data to what type you want.
  */
 MsimMessageElement *
-msim_msg_get(MsimMessage *msg, const gchar *name)
+msim_msg_get(const MsimMessage *msg, const gchar *name)
 {
 	GList *node;
 
@@ -1115,7 +1115,7 @@
  * This function unescapes the string for you, if needed.
  */
 gchar *
-msim_msg_get_string(MsimMessage *msg, const gchar *name)
+msim_msg_get_string(const MsimMessage *msg, const gchar *name)
 {
 	MsimMessageElement *elem;
 
@@ -1185,7 +1185,7 @@
  * Return an element as a new list. Caller frees with msim_msg_list_free().
  */
 GList *
-msim_msg_get_list(MsimMessage *msg, const gchar *name)
+msim_msg_get_list(const MsimMessage *msg, const gchar *name)
 {
 	MsimMessageElement *elem;
 
@@ -1279,7 +1279,7 @@
  * Return an element as a new dictionary. Caller frees with msim_msg_free().
  */
 MsimMessage *
-msim_msg_get_dictionary(MsimMessage *msg, const gchar *name)
+msim_msg_get_dictionary(const MsimMessage *msg, const gchar *name)
 {
 	MsimMessageElement *elem;
 
@@ -1321,7 +1321,7 @@
  * be converted handled correctly, for example.
  */
 guint
-msim_msg_get_integer(MsimMessage *msg, const gchar *name)
+msim_msg_get_integer(const MsimMessage *msg, const gchar *name)
 {
 	MsimMessageElement *elem;
 
@@ -1398,7 +1398,7 @@
  * @return TRUE if successful, FALSE if not.
  */
 gboolean
-msim_msg_get_binary(MsimMessage *msg, const gchar *name,
+msim_msg_get_binary(const MsimMessage *msg, const gchar *name,
 		gchar **binary_data, gsize *binary_length)
 {
 	MsimMessageElement *elem;