pidgin: ac789033: Plug a small memory leak in the smiley d...

sadrul at pidgin.im sadrul at pidgin.im
Tue May 6 22:55:43 EDT 2008


-----------------------------------------------------------------
Revision: ac789033b0d69b98d5985567ad5d3579bde9af12
Ancestor: e329deab9a997b434a84c2b7837324aee4f73e51
Author: sadrul at pidgin.im
Date: 2008-05-07T00:35:55
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ac789033b0d69b98d5985567ad5d3579bde9af12

Modified files:
        pidgin/gtkimhtmltoolbar.c

ChangeLog: 

Plug a small memory leak in the smiley dialog, and use g_new0/g_free
instead of malloc/free.

-------------- next part --------------
============================================================
--- pidgin/gtkimhtmltoolbar.c	e21be01eb28ab2c96012516d71ad3558dab32185
+++ pidgin/gtkimhtmltoolbar.c	bb0f6cb4e8a66237645d15ecb440332f6444b5b6
@@ -620,7 +620,7 @@ sort_smileys(struct smiley_button_list *
 	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 @@ insert_smiley_cb(GtkWidget *smiley, GtkI
 		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 @@ insert_smiley_cb(GtkWidget *smiley, GtkI
 			}
 			col++;
 			it = it->next;
-			free(it_tmp);
+			g_free(it_tmp);
 		}
 		gtk_box_pack_start(GTK_BOX(smiley_table), line, FALSE, TRUE, 0);
 


More information about the Commits mailing list