changeset 4138:6b2d0ce7fb18

[gaim-migrate @ 4356] this should fix some memory leaks, thanks to ari for taking the time to work on this committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 25 Dec 2002 02:13:35 +0000
parents 22875a399312
children d03ace5af8da
files src/conversation.c src/dialogs.c src/gtkimhtml.c
diffstat 3 files changed, 44 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Wed Dec 25 00:51:00 2002 +0000
+++ b/src/conversation.c	Wed Dec 25 02:13:35 2002 +0000
@@ -95,82 +95,103 @@
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "smile.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":)", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-)", NULL, filename);	
+	g_free(filename);
 
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "sad.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":(", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-(", NULL, filename);	
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "wink.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ";)", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ";-)", NULL, filename);	
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "tongue.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-p", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-P", NULL, filename);	
-
+	g_free(filename);
+	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "scream.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "=-O", NULL, filename);
-	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "=-o", NULL, filename);			
+	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "=-o", NULL, filename);
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "kiss.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-*", NULL, filename);
+	g_free(filename);
 
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "yell.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:o", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:O", NULL, filename);
-
+	g_free(filename);
+	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "cool.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "8-)", NULL, filename);
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "moneymouth.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-$", NULL, filename);	
-
+	g_free(filename);
+	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "burp.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-!", NULL, filename);		
-
+	g_free(filename);
+	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "embarrassed.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-[", NULL, filename);		
-
+	g_free(filename);
+	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "cry.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":'(", NULL, filename);	
-
+	g_free(filename);
+	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "think.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-/", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-\\", NULL, filename);
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "crossedlips.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-x", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-X", NULL, filename); 
-
+	g_free(filename);
+	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "bigsmile.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-d", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-D", NULL, filename); 	
-
+	g_free(filename);
+	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "angel.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "O:-)", NULL, filename);	
-
+	g_free(filename);
 
 	/* "Secret" smileys */
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "luke.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:)", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:-)", NULL, filename);
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "oneeye.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "O-)", NULL, filename);
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "crazy.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:)", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:-)", NULL, filename);
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "mrt.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-o)))", NULL, filename);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-O)))", NULL, filename);
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "download.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "8-|)", NULL, filename);
+	g_free(filename);
 	
 	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "farted.png", NULL);
 	gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-]", NULL, filename);
+	g_free(filename);
 }
 
 void gaim_setup_imhtml(GtkWidget *imhtml)
--- a/src/dialogs.c	Wed Dec 25 00:51:00 2002 +0000
+++ b/src/dialogs.c	Wed Dec 25 02:13:35 2002 +0000
@@ -582,6 +582,7 @@
 	
 	destroy_dialog(NULL, imdialog);
 	imdialog = NULL;
+	g_free(info);
 }
 
 static void do_info(GtkWidget *widget, int resp, struct getuserinfo *info)
@@ -602,6 +603,7 @@
 		g_free(who);
 	}
 	gtk_widget_destroy(GTK_WIDGET(widget));
+	g_free(info);
 }
 
 void show_ee_dialog(int ee)
@@ -681,6 +683,8 @@
 	GtkWidget *img = gtk_image_new_from_file(filename);
 	struct getuserinfo *info = NULL;
 
+	g_free(filename);
+
 	if (!imdialog) {
 		info = g_new0(struct getuserinfo, 1);
 		info->gc = connections->data;
@@ -781,6 +785,7 @@
 	struct getuserinfo *info = g_new0(struct getuserinfo, 1);
 	char buf[256];
 
+	g_free(filename);
 	info->gc = connections->data;
 
 	window = gtk_dialog_new_with_buttons("", blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, 
@@ -944,8 +949,9 @@
 	GtkWidget *label;
 	char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL);
 	GtkWidget *img = gtk_image_new_from_file(filename);
-
 	struct addbuddy *a = g_new0(struct addbuddy, 1);
+
+	g_free(filename);
 	a->gc = gc;
 
 	a->window =  gtk_dialog_new_with_buttons("", GTK_WINDOW(blist), GTK_DIALOG_MODAL, 
--- a/src/gtkimhtml.c	Wed Dec 25 00:51:00 2002 +0000
+++ b/src/gtkimhtml.c	Wed Dec 25 02:13:35 2002 +0000
@@ -132,8 +132,11 @@
 {
 	GtkIMHtml *imhtml = GTK_IMHTML(object);
 
-	g_hash_table_foreach_remove(imhtml->smiley_data, gtk_smiley_tree_destroy, NULL);
+	g_hash_table_foreach_remove(imhtml->smiley_data, (GHRFunc)gtk_smiley_tree_destroy, NULL);
+	g_hash_table_destroy(imhtml->smiley_data);
 	gtk_smiley_tree_destroy(imhtml->default_smilies);
+	gdk_cursor_unref(imhtml->hand_cursor);
+	gdk_cursor_unref(imhtml->arrow_cursor);
 	G_OBJECT_CLASS(parent_class)->finalize (object);
 }
 
@@ -902,6 +905,8 @@
 				}
 			c += tlen;
 			pos += tlen;
+			if(tag)
+				g_free(tag); /* This was allocated back in VALID_TAG() */
 		} else if (*c == '&' && gtk_imhtml_is_amp_escape (c, &amp, &tlen)) {
 			ws [wpos++] = amp;
 			c += tlen;