changeset 22453:34b8d1107b06

Fix multiple memory leaks
author Stu Tomlinson <stu@nosnilmot.com>
date Wed, 12 Mar 2008 01:38:51 +0000
parents bb7b11ca28ca
children ab2c3a93267e 22fce0be8ed0
files ChangeLog pidgin/plugins/spellchk.c
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Mar 12 01:37:15 2008 +0000
+++ b/ChangeLog	Wed Mar 12 01:38:51 2008 +0000
@@ -23,6 +23,7 @@
 	* Fix some cases of the conversation input entry area being 1 pixel high
 	* Fix for displaying channel & buddy names in conversation window when
 	  they have '&' in them
+	* Some memory leak fixes, especially in the Text Replacement plugin
 
 	Finch:
 	* Fix compiling with Glib older than 2.6
--- a/pidgin/plugins/spellchk.c	Wed Mar 12 01:37:15 2008 +0000
+++ b/pidgin/plugins/spellchk.c	Wed Mar 12 01:38:51 2008 +0000
@@ -64,7 +64,7 @@
 	GtkTextMark *mark_insert_start;
 	GtkTextMark *mark_insert_end;
 
-	const gchar *word;
+	gchar *word;
 	gboolean inserting;
 	gboolean ignore_correction;
 	gboolean ignore_correction_on_send;
@@ -265,6 +265,7 @@
 				g_value_unset(&val1);
 				g_value_unset(&val2);
 
+				g_free(lowerword);
 				g_free(foldedword);
 				return outword;
 			}
@@ -274,6 +275,7 @@
 
 		} while (gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter));
 	}
+	g_free(lowerword);
 	g_free(foldedword);
 
 	return NULL;
@@ -292,6 +294,7 @@
 			G_SIGNAL_MATCH_DATA,
 			0, 0, NULL, NULL,
 			spell);
+	g_free(spell->word);
 	g_free(spell);
 }
 
@@ -440,6 +443,7 @@
 	/* Move backwards to the beginning of the word. */
 	spellchk_backward_word_start(&start);
 
+	g_free(spell->word);
 	spell->word = gtk_text_iter_get_text(&start, &end);
 
 	/* Hack because otherwise typing things like U.S. gets difficult
@@ -484,6 +488,7 @@
 	}
 	g_free(tmp);
 
+	g_free(spell->word);
 	spell->word = NULL;
 
 	return replaced;
@@ -504,6 +509,7 @@
 
 	spell->inserting = TRUE;
 
+	g_free(spell->word);
 	spell->word = NULL;
 
 	gtk_text_buffer_move_mark(buffer, spell->mark_insert_start, iter);
@@ -561,6 +567,7 @@
 	place = gtk_text_iter_get_offset(&pos);
 
 	if ((place + 1) != spell->pos) {
+		g_free(spell->word);
 		spell->word = NULL;
 		return;
 	}
@@ -574,6 +581,7 @@
 	spell->ignore_correction_on_send = TRUE;
 
 	spell->inserting = FALSE;
+	g_free(spell->word);
 	spell->word = NULL;
 }