changeset 22849:28005860d2c9

Plug a small memory leak in the smiley dialog, and use g_new0/g_free instead of malloc/free.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 07 May 2008 00:35:55 +0000
parents 29235834c692
children 4409f8a0d7aa
files pidgin/gtkimhtmltoolbar.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkimhtmltoolbar.c	Wed May 07 00:34:52 2008 +0000
+++ b/pidgin/gtkimhtmltoolbar.c	Wed May 07 00:35:55 2008 +0000
@@ -620,7 +620,7 @@
 	struct smiley_button_list *cur;
 	struct smiley_button_list *it, *it_last;
 
-	cur = malloc(sizeof(struct smiley_button_list));
+	cur = g_new0(struct smiley_button_list, 1);
 	it = ls;
 	it_last = ls; /* list iterators*/
 	image = gtk_image_new_from_file(filename);
@@ -732,10 +732,9 @@
 		while (unique_smileys) {
 			GtkIMHtmlSmiley *smiley = unique_smileys->data;
 			if (!smiley->hidden) {
-				fflush(stdout);
 				ls = sort_smileys(ls, toolbar, &max_line_width, smiley->file, smiley->smile);
 			}
-			unique_smileys = unique_smileys->next;
+			unique_smileys = g_slist_delete_link(unique_smileys, unique_smileys);
 		}
 		/* pack buttons of the list */
 		max_line_width = max_line_width / num_lines;
@@ -754,7 +753,7 @@
 			}
 			col++;
 			it = it->next;
-			free(it_tmp);
+			g_free(it_tmp);
 		}
 		gtk_box_pack_start(GTK_BOX(smiley_table), line, FALSE, TRUE, 0);