pidgin: c828bc32: Fix multiple memory leaks

nosnilmot at pidgin.im nosnilmot at pidgin.im
Tue Mar 11 21:50:51 EDT 2008


-----------------------------------------------------------------
Revision: c828bc32e00b89aaf677ddacdea358c180e3a149
Ancestor: ff15da6d15d666ee2501ad3a2c0a4678edf0d4ec
Author: nosnilmot at pidgin.im
Date: 2008-03-12T01:38:51
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c828bc32e00b89aaf677ddacdea358c180e3a149

Modified files:
        ChangeLog pidgin/plugins/spellchk.c

ChangeLog: 

Fix multiple memory leaks

-------------- next part --------------
============================================================
--- ChangeLog	29b81553fbfe99af7e1eeef267dc26481c7deadf
+++ ChangeLog	3fd077c50ac96c553e8dd760aebaecbdbc7e7097
@@ -23,6 +23,7 @@ version 2.4.1 ():
 	* 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
============================================================
--- pidgin/plugins/spellchk.c	1306cb89e97b6960893cc685392a72d2776026bc
+++ pidgin/plugins/spellchk.c	af8011f176daf1bd73eb302733de5446987281e5
@@ -64,7 +64,7 @@ struct _spellchk {
 	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 @@ substitute_word(gchar *word)
 				g_value_unset(&val1);
 				g_value_unset(&val2);
 
+				g_free(lowerword);
 				g_free(foldedword);
 				return outword;
 			}
@@ -274,6 +275,7 @@ substitute_word(gchar *word)
 
 		} while (gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter));
 	}
+	g_free(lowerword);
 	g_free(foldedword);
 
 	return NULL;
@@ -292,6 +294,7 @@ spellchk_free(spellchk *spell)
 			G_SIGNAL_MATCH_DATA,
 			0, 0, NULL, NULL,
 			spell);
+	g_free(spell->word);
 	g_free(spell);
 }
 
@@ -440,6 +443,7 @@ check_range(spellchk *spell, GtkTextBuff
 	/* 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 @@ check_range(spellchk *spell, GtkTextBuff
 	}
 	g_free(tmp);
 
+	g_free(spell->word);
 	spell->word = NULL;
 
 	return replaced;
@@ -504,6 +509,7 @@ insert_text_before(GtkTextBuffer *buffer
 
 	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 @@ delete_range_after(GtkTextBuffer *buffer
 	place = gtk_text_iter_get_offset(&pos);
 
 	if ((place + 1) != spell->pos) {
+		g_free(spell->word);
 		spell->word = NULL;
 		return;
 	}
@@ -574,6 +581,7 @@ delete_range_after(GtkTextBuffer *buffer
 	spell->ignore_correction_on_send = TRUE;
 
 	spell->inserting = FALSE;
+	g_free(spell->word);
 	spell->word = NULL;
 }
 


More information about the Commits mailing list