changeset 4630:5cdfd20daa07

[gaim-migrate @ 4921] Faceprint found these leaks. Anyone else want to find any? committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 01 Mar 2003 18:37:48 +0000
parents 86fd0f6eaa1a
children 1b4d18a6bcf5
files src/dialogs.c src/gtkconv.c src/gtkconv.h src/gtkimhtml.c src/multi.c src/themes.c
diffstat 6 files changed, 49 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Sat Mar 01 02:30:24 2003 +0000
+++ b/src/dialogs.c	Sat Mar 01 18:37:48 2003 +0000
@@ -3532,6 +3532,7 @@
 
 int check_away_mess(struct create_away *ca, int type)
 {
+	char *msg;
 	if ((strlen(gtk_entry_get_text(GTK_ENTRY(ca->entry))) == 0) && (type == 1)) {
 		/* We shouldn't allow a blank title */
 		do_error_dialog(_("You cannot save an away message with a blank title"), 
@@ -3540,12 +3541,16 @@
 		return 0;
 	}
 
-	if (!gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE) && (type <= 1)) {
+	msg = gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE);
+
+	if (!msg && (type <= 1)) {
 		/* We shouldn't allow a blank message */
 		do_error_dialog(_("You cannot create an empty away message"), NULL, GAIM_ERROR);
 		return 0;
 	}
 
+	g_free(msg);
+
 	return 1;
 }
 
--- a/src/gtkconv.c	Sat Mar 01 02:30:24 2003 +0000
+++ b/src/gtkconv.c	Sat Mar 01 18:37:48 2003 +0000
@@ -2444,32 +2444,33 @@
 {
 	struct gaim_gtk_window *gtkwin;
 	GtkWidget *hb;
-	GtkItemFactory *item_factory;
 
 	gtkwin = GAIM_GTK_WINDOW(win);
 
 	/* Create the handle box. */
 	hb = gtk_handle_box_new();
 
-	item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", NULL);
-
-	gtk_item_factory_set_translate_func (item_factory,
+	gtkwin->menu.item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR,
+			"<main>", NULL);
+
+	gtk_item_factory_set_translate_func (gtkwin->menu.item_factory,
 					     item_factory_translate_func,
 					     NULL, NULL);
-	
-	gtk_item_factory_create_items(item_factory, menu_item_count,
+
+	gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count,
 								  menu_items, win);
 
-	gtkwin->menu.menubar = gtk_item_factory_get_widget(item_factory, "<main>");
-	gtkwin->menu.view_history = gtk_item_factory_get_widget(item_factory,
+	gtkwin->menu.menubar = gtk_item_factory_get_widget(gtkwin->menu.item_factory,
+			"<main>");
+	gtkwin->menu.view_history = gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 			"/Conversation/View History...");
-	gtkwin->menu.insert_link = gtk_item_factory_get_widget(item_factory,
+	gtkwin->menu.insert_link = gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 			"/Conversation/Insert URL...");
-	gtkwin->menu.insert_image = gtk_item_factory_get_widget(item_factory,
+	gtkwin->menu.insert_image = gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 			"/Conversation/Insert Image...");
-	gtkwin->menu.logging = gtk_item_factory_get_widget(item_factory,
+	gtkwin->menu.logging = gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 			"/Options/Enable Logging");
-	gtkwin->menu.sounds = gtk_item_factory_get_widget(item_factory,
+	gtkwin->menu.sounds = gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 			"/Options/Enable Sounds");
 
 	generate_send_as_items(win, NULL);
@@ -3251,6 +3252,8 @@
 
 	gaim_gtk_set_state_lock(FALSE);
 
+	g_object_unref(G_OBJECT(gtkwin->menu.item_factory));
+
 	g_free(gtkwin);
 	win->ui_data = NULL;
 }
@@ -3622,6 +3625,8 @@
 		g_free(gtkconv->u.chat);
 	}
 
+	g_object_unref(G_OBJECT(gtkconv->tooltips));
+
 	g_free(gtkconv);
 }
 
--- a/src/gtkconv.h	Sat Mar 01 02:30:24 2003 +0000
+++ b/src/gtkconv.h	Sat Mar 01 18:37:48 2003 +0000
@@ -53,6 +53,8 @@
 		GtkWidget *sounds;
 		GtkWidget *send_as;
 
+		GtkItemFactory *item_factory;
+
 	} menu;
 
 	/* Tab dragging stuff. */
--- a/src/gtkimhtml.c	Sat Mar 01 02:30:24 2003 +0000
+++ b/src/gtkimhtml.c	Sat Mar 01 18:37:48 2003 +0000
@@ -1120,6 +1120,8 @@
 		}
 	}
 	g_free (ws);
+	if(bg)
+		g_free(bg);
 	if (!(options & GTK_IMHTML_NO_SCROLL))
 		gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (imhtml), mark,
 					      0, TRUE, 0.0, 1.0);
--- a/src/multi.c	Sat Mar 01 02:30:24 2003 +0000
+++ b/src/multi.c	Sat Mar 01 18:37:48 2003 +0000
@@ -274,9 +274,11 @@
 												NULL);
 
 	/* Data */
+	/*
 	column = gtk_tree_view_column_new();
-//	gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
+	gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
 	gtk_tree_view_column_set_visible(column, FALSE);
+	*/
 }
 
 static GtkWidget *generate_list()
--- a/src/themes.c	Sat Mar 01 02:30:24 2003 +0000
+++ b/src/themes.c	Sat Mar 01 18:37:48 2003 +0000
@@ -70,7 +70,7 @@
 	GSList *lst = smiley_themes;
 	char *dirname;
 	gboolean old=FALSE;
-	
+
 	while (lst) {
 		struct smiley_theme *thm = lst->data;
 		if (!strcmp(thm->path, file)) {
@@ -80,13 +80,14 @@
 		}
 		lst = lst->next;
 	}
+
+	if (!f)
+		return NULL;
 	if (!theme) {
 		theme = g_new0(struct smiley_theme, 1);
 		theme->path = g_strdup(file);
 	}
-	if (!f)
-		return NULL;
-	
+
 	dirname = g_path_get_dirname(file);
 	if (load) {
 		if (current_smiley_theme) {
@@ -113,24 +114,24 @@
 		}
 		current_smiley_theme = theme;
 	}
-	
-	
+
+
 	while (!feof(f)) {
 		if (!fgets(buf, sizeof(buf), f)) {
 			break;
 		}
-				
-		if (buf[0] == '#' || buf[0] == '\0') 
+
+		if (buf[0] == '#' || buf[0] == '\0')
 			continue;
-		
+
 		i = buf;
 		while (isspace(*i))
 			i++;
-		
+
 		if (*i == '[' && strchr(i, ']') && load) {
 			struct smiley_list *child = g_new0(struct smiley_list, 1);
 			child->sml = g_strndup(i+1, (int)strchr(i, ']') - (int)i - 1);
-			if (theme->list) 
+			if (theme->list)
 				list->next = child;
 			else
 				theme->list = child;
@@ -150,8 +151,7 @@
 		} else if (load && list) {
 			gboolean hidden;
 			char *sfile = NULL;
-			GtkIMHtmlSmiley *smiley = g_new0(GtkIMHtmlSmiley, 1);
-			
+
 			if (*i == '!' && *(i + 1) == ' ') {
 				hidden = TRUE;
 				i = i + 2;
@@ -159,31 +159,31 @@
 			while  (*i) {
 				char l[64];
 				int li = 0;
-				while (!isspace(*i)) 
+				while (!isspace(*i))
 					l[li++] = *(i++);
 				if (!sfile) {
 					l[li] = 0;
 					sfile = g_build_filename(dirname, l, NULL);
 				} else {
 					l[li] = 0;
-					smiley = g_new0(GtkIMHtmlSmiley, 1);
+					GtkIMHtmlSmiley *smiley = g_new0(GtkIMHtmlSmiley, 1);
 					smiley->file = sfile;
 					smiley->smile = g_strdup(l);
 					list->smileys = g_slist_append(list->smileys, smiley);
 				}
-				while (isspace(*i)) 
+				while (isspace(*i))
 					i++;
-				
+
 			}
 		}
 	}
 
 	if (load) {
 		GList *cnv;
-		
+
 		for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) {
 			struct gaim_conversation *conv = cnv->data;
-			
+
 			if (GAIM_IS_GTK_CONVERSATION(conv))
 				smiley_themeize(GAIM_GTK_CONVERSATION(conv)->imhtml);
 		}