pidgin: 248addd0: Fix a bunch of memory leaks reported by ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Aug 2 01:40:46 EDT 2009


-----------------------------------------------------------------
Revision: 248addd0286fe0c7b5d98b6766a30e184d27ce2f
Ancestor: 910949d93091afc24529b51807c9c4de3626c2df
Author: darkrain42 at pidgin.im
Date: 2009-08-02T05:04:41
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/248addd0286fe0c7b5d98b6766a30e184d27ce2f

Modified files:
        ChangeLog libpurple/cipher.c libpurple/desktopitem.c
        libpurple/ft.c libpurple/protocols/gg/lib/libgadu.c
        libpurple/protocols/jabber/google.c
        libpurple/protocols/msn/directconn.c
        libpurple/protocols/msnp9/directconn.c
        libpurple/protocols/yahoo/libymsg.c
        libpurple/protocols/yahoo/yahoo_filexfer.c pidgin/gtkprefs.c
        pidgin/plugins/crazychat/glm.c

ChangeLog: 

Fix a bunch of memory leaks reported by Josh Mueller. Refs #9822.

-------------- next part --------------
============================================================
--- ChangeLog	8355b64b0d07de55fd3e757586667da2d3197469
+++ ChangeLog	ae5e18903d82991dd4fe7978c887e775c8c3f4ca
@@ -44,6 +44,7 @@ version 2.6.0 (??/??/2009):
 	* Install scalable versions of the main Pidgin icon, the protocol icons,
 	  the dialog icons, and the Buddy List emblems.
 	* Build properly on Hurd.  (Marc Dequ?nes)
+	* Various memory leaks fixed as reported by Josh Mueller.
 
 	AIM and ICQ:
 	* Preliminary support for a new authentication scheme called
============================================================
--- libpurple/cipher.c	10bafb597e824bff2acd6f634db65eea6e36764e
+++ libpurple/cipher.c	a01e41ae1b8c336d0919a3937f87f7304cfd7a72
@@ -2727,8 +2727,6 @@ purple_ciphers_uninit() {
 
 		cipher = PURPLE_CIPHER(l->data);
 		purple_ciphers_unregister_cipher(cipher);
-
-		ciphers = g_list_remove(ciphers, cipher);
 	}
 
 	g_list_free(ciphers);
============================================================
--- libpurple/desktopitem.c	e3825afbffac45d7b07252bcd94b279bef402f28
+++ libpurple/desktopitem.c	6ffa6d9f10ee76c57306587e2e43e37a5499f3e1
@@ -831,11 +831,10 @@ try_english_key (PurpleDesktopItem *item
 static char *
 try_english_key (PurpleDesktopItem *item, const char *key)
 {
-	char *str;
+	char *str = NULL;
 	char *locales[] = { "en_US", "en_GB", "en_AU", "en", NULL };
 	int i;
 
-	str = NULL;
 	for (i = 0; locales[i] != NULL && str == NULL; i++) {
 		str = g_strdup (lookup_locale (item, key, locales[i]));
 	}
============================================================
--- libpurple/ft.c	811705de6d0cca1eb7fd100768ddbc62652f7554
+++ libpurple/ft.c	7562e3968f099ac5af95656c018c85a7806c2c99
@@ -953,15 +953,15 @@ transfer_cb(gpointer data, gint source, 
 			if (wc != r) {
 				purple_debug_error("filetransfer", "Unable to write whole buffer.\n");
 				purple_xfer_cancel_local(xfer);
+				g_free(buffer);
 				return;
 			}
 		} else if(r < 0) {
 			purple_xfer_cancel_remote(xfer);
+			g_free(buffer);
 			return;
 		}
-	}
-
-	if (condition & PURPLE_INPUT_WRITE) {
+	} else if (condition & PURPLE_INPUT_WRITE) {
 		size_t result;
 		size_t s = MIN(purple_xfer_get_bytes_remaining(xfer), xfer->current_buffer_size);
 
============================================================
--- libpurple/protocols/gg/lib/libgadu.c	f1bef314ab64c75e4d40ff5671c8c5ca7d774b39
+++ libpurple/protocols/gg/lib/libgadu.c	06b4658a78b391f3baa4114f1d9468a17b0e683c
@@ -790,6 +790,7 @@ void *gg_recv_packet(struct gg_session *
 		gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv(%d,%p,%d) = %d\n", sess->fd, buf + sizeof(h) + offset, size, ret);
 		if (!ret) {
 			gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv() failed: connection broken\n");
+			free(buf);
 			errno = ECONNRESET;
 			return NULL;
 		}
============================================================
--- libpurple/protocols/jabber/google.c	4f26c475229f4b4a3bf44ca393cbe48768eb4a55
+++ libpurple/protocols/jabber/google.c	8c6f3b6cd4b976a890b5c2cd198d8b3826e1dd26
@@ -430,7 +430,7 @@ jabber_google_session_initiate(JabberStr
 	return (session->media != NULL) ? TRUE : FALSE;
 }
 
-static void
+static gboolean
 google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
 {
 	JabberIq *result;
@@ -443,7 +443,7 @@ google_session_handle_initiate(JabberStr
 
 	if (session->state != UNINIT) {
 		purple_debug_error("jabber", "Received initiate for active session.\n");
-		return;
+		return FALSE;
 	}
 
 	desc_element = xmlnode_get_child(sess, "description");
@@ -456,7 +456,7 @@ google_session_handle_initiate(JabberStr
 	else {
 		purple_debug_error("jabber", "Received initiate with "
 				"invalid namespace %s.\n", xmlns);
-		return;
+		return FALSE;
 	}
 
 	session->media = purple_media_manager_create_media(
@@ -480,7 +480,7 @@ google_session_handle_initiate(JabberStr
 				PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE);
 		google_session_send_terminate(session);
 		g_free(params);
-		return;
+		return FALSE;
 	}
 
 	g_free(params);
@@ -551,6 +551,8 @@ google_session_handle_initiate(JabberStr
 	jabber_iq_set_id(result, iq_id);
 	xmlnode_set_attrib(result->node, "to", session->remote_jid);
 	jabber_iq_send(result);
+
+	return TRUE;
 }
 
 static void
@@ -776,7 +778,8 @@ jabber_google_session_parse(JabberStream
 	session->js = js;
 	session->remote_jid = g_strdup(session->id.initiator);
 
-	google_session_parse_iq(js, session, session_node, iq_id);
+	if (!google_session_handle_initiate(js, session, session_node, iq_id))
+		google_session_destroy(session);
 }
 #endif /* USE_VV */
 
============================================================
--- libpurple/protocols/msn/directconn.c	8bf4a63349fc5fc7d48bb09e785ed524e2731c2e
+++ libpurple/protocols/msn/directconn.c	f4f13ce115faa3d1b17831c7496bd854328938b0
@@ -351,6 +351,8 @@ read_cb(gpointer data, gint source, Purp
 
 		msn_directconn_destroy(directconn);
 	}
+
+	g_free(body);
 }
 
 static void
============================================================
--- libpurple/protocols/msnp9/directconn.c	0971eebe47f76c7b74fc738a291a4e3061ef17c0
+++ libpurple/protocols/msnp9/directconn.c	0bddb680a0005fa3e66aac5b6443872dbf2cf20a
@@ -355,6 +355,8 @@ read_cb(gpointer data, gint source, Purp
 
 		msn_directconn_destroy(directconn);
 	}
+
+	g_free(body);
 }
 
 static void
============================================================
--- libpurple/protocols/yahoo/libymsg.c	94006e18d78b447a7fa7f0c9a1cb3eec9973437b
+++ libpurple/protocols/yahoo/libymsg.c	9022ac959f817e6065cd41377b6c84e524ba41af
@@ -1830,6 +1830,7 @@ static void yahoo_auth16_stage1_cb(Purpl
 			g_free(error_reason);
 			g_free(auth_data->seed);
 			g_free(auth_data);
+			g_free(token);
 		}
 		else {
 			/* OK to login, correct information provided */
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c	04618d50e00b44ab33a6c0585ca6b022eb90d5d9
+++ libpurple/protocols/yahoo/yahoo_filexfer.c	9847f1ca4caf96df6df2a215310eca27d075b059
@@ -1593,7 +1593,7 @@ void yahoo_process_filetrans_15(PurpleCo
 	char *service = NULL;
 	char *filename = NULL;
 	char *xfer_peer_idstring = NULL;
-	char *utf8_filename
+	char *utf8_filename;
 	unsigned long filesize = 0L;
 	GSList *l;
 	GSList *filename_list = NULL;
============================================================
--- pidgin/gtkprefs.c	4bc66df47e739861e93ad1ff6ab8da3f1d2b3cad
+++ pidgin/gtkprefs.c	9797dec7f7e899160ea43f045293be027a5b547d
@@ -698,7 +698,8 @@ theme_install_theme(char *path, struct t
 		g_free(original_name);
 		g_free(info);
 		return;
-	} else g_free(info);
+	} else
+		g_free(info);
 
 	is_archive = !g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz");
 
@@ -1032,8 +1033,6 @@ request_theme_file_name_cb(gpointer data
 	info->original_name = NULL;
 
 	theme_install_theme(theme_file_name, info);
-
-	g_free(info);
 }
 
 static void
============================================================
--- pidgin/plugins/crazychat/glm.c	85515736630328b16d6830f8e0e556af4fc895e2
+++ pidgin/plugins/crazychat/glm.c	446f2a6f994f33331973847f71b36e3aeb5dfa25
@@ -543,6 +543,8 @@ glmWriteMTL(GLMmodel* model, char* model
     fprintf(file, "Ns %f\n", material->shininess / 128.0 * 1000.0);
     fprintf(file, "\n");
   }
+
+  fclose(file);
 }
 
 


More information about the Commits mailing list