gthumb r2536 - in branches/gthumb-2-10: . libgthumb src



Author: mjc
Date: Wed Apr  8 00:54:57 2009
New Revision: 2536
URL: http://svn.gnome.org/viewvc/gthumb?rev=2536&view=rev

Log:
2009-04-07  Michael J. Chudobiak  <mjc svn gnome org>

        * libgthumb/pixbuf-utils.c: (_gdk_pixbuf_save_as_jpeg):
        * src/dlg-bookmarks.c: (dlg_edit_bookmarks):
        * src/dlg-catalog.c: (dlg_add_to_catalog),
        (dlg_move_to_catalog_directory):
        * src/dlg-comment.c: (dlg_comment_new):
        * src/dlg-duplicates.c: (dlg_duplicates):
        * src/dlg-png-exporter.c: (dlg_png_exporter_pref):
        Plugged a variety of small memory leaks, detected using
        "cppcheck -q -a -f .". Bug #578282.



Modified:
   branches/gthumb-2-10/ChangeLog
   branches/gthumb-2-10/NEWS
   branches/gthumb-2-10/libgthumb/pixbuf-utils.c
   branches/gthumb-2-10/src/dlg-bookmarks.c
   branches/gthumb-2-10/src/dlg-catalog.c
   branches/gthumb-2-10/src/dlg-comment.c
   branches/gthumb-2-10/src/dlg-duplicates.c
   branches/gthumb-2-10/src/dlg-png-exporter.c

Modified: branches/gthumb-2-10/NEWS
==============================================================================
--- branches/gthumb-2-10/NEWS	(original)
+++ branches/gthumb-2-10/NEWS	Wed Apr  8 00:54:57 2009
@@ -6,6 +6,7 @@
 	* Made the OK button the default widget in the rename dialog.
 	* The existing import scripts did not properly unmount gvfs-mounted
         cameras. Gnome bug #560352, Ubuntu bug #351122.
+	* Fixed various small memory leaks, bug #578282.
 
 
 version 2.10.11

Modified: branches/gthumb-2-10/libgthumb/pixbuf-utils.c
==============================================================================
--- branches/gthumb-2-10/libgthumb/pixbuf-utils.c	(original)
+++ branches/gthumb-2-10/libgthumb/pixbuf-utils.c	Wed Apr  8 00:54:57 2009
@@ -661,6 +661,7 @@
 			     GDK_PIXBUF_ERROR,
 			     GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
 			     "Couldn't allocate memory for loading JPEG file");
+		fclose (file);
 		return FALSE;
 	}
 
@@ -673,6 +674,7 @@
 	if (sigsetjmp (jerr.setjmp_buffer, 1)) {
 		jpeg_destroy_compress (&cinfo);
 		g_free (buf);
+		fclose (file);
 		return FALSE;
 	}
 

Modified: branches/gthumb-2-10/src/dlg-bookmarks.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-bookmarks.c	(original)
+++ branches/gthumb-2-10/src/dlg-bookmarks.c	Wed Apr  8 00:54:57 2009
@@ -272,15 +272,16 @@
 
 	data = g_new0 (DialogData, 1);
 
-	data->browser = browser;
-	data->do_not_update = FALSE;
-
 	data->gui = glade_xml_new (GTHUMB_GLADEDIR "/" GLADE_FILE, NULL, NULL);
         if (! data->gui) {
                 g_warning ("Could not find " GLADE_FILE "\n");
+		g_free (data);
                 return;
         }
 
+	data->browser = browser;
+	data->do_not_update = FALSE;
+
 	/* Get the widgets. */
 
 	data->dialog = glade_xml_get_widget (data->gui, "bookmarks_dialog");

Modified: branches/gthumb-2-10/src/dlg-catalog.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-catalog.c	(original)
+++ branches/gthumb-2-10/src/dlg-catalog.c	Wed Apr  8 00:54:57 2009
@@ -279,6 +279,13 @@
 
 	data = g_new (DialogData, 1);
 
+	data->gui = glade_xml_new (GTHUMB_GLADEDIR "/" GLADE_FILE, NULL, NULL);
+	if (! data->gui) {
+		g_warning ("Could not find " GLADE_FILE "\n");
+		g_free (data);
+		return;
+        }
+
 	data->window = window;
 	data->cat_list = catalog_list_new (FALSE);
 	data->data.list = list;
@@ -290,12 +297,6 @@
 	} else
 		data->current_dir = get_catalog_full_path (NULL);
 
-	data->gui = glade_xml_new (GTHUMB_GLADEDIR "/" GLADE_FILE, NULL, NULL);
-	if (! data->gui) {
-		g_warning ("Could not find " GLADE_FILE "\n");
-		return;
-        }
-
 	/* Get the widgets. */
 
 	data->dialog = glade_xml_get_widget (data->gui, "catalog_dialog");
@@ -447,18 +448,19 @@
 
 	data = g_new (DialogData, 1);
 
-	data->window = window;
-	data->current_dir = get_catalog_full_path (NULL);
-	data->cat_list = catalog_list_new (FALSE);
-	catalog_list_show_dirs_only (data->cat_list, TRUE);
-	data->data.catalog_path = catalog_path;
-
 	data->gui = glade_xml_new (GTHUMB_GLADEDIR "/" GLADE_FILE, NULL, NULL);
 	if (! data->gui) {
 		g_warning ("Could not find " GLADE_FILE "\n");
+		g_free (data);
 		return;
         }
 
+	data->window = window;
+	data->current_dir = get_catalog_full_path (NULL);
+	data->cat_list = catalog_list_new (FALSE);
+	catalog_list_show_dirs_only (data->cat_list, TRUE);
+	data->data.catalog_path = catalog_path;
+
 	/* Get the widgets. */
 
 	data->dialog = glade_xml_get_widget (data->gui, "catalog_dialog");

Modified: branches/gthumb-2-10/src/dlg-comment.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-comment.c	(original)
+++ branches/gthumb-2-10/src/dlg-comment.c	Wed Apr  8 00:54:57 2009
@@ -351,14 +351,15 @@
 
 	data = g_new0 (DialogData, 1);
 
-	data->window = window;
-
 	data->gui = glade_xml_new (GTHUMB_GLADEDIR "/" GLADE_FILE , NULL, NULL);
         if (!data->gui) {
                 g_warning ("Could not find " GLADE_FILE "\n");
+		g_free (data);
                 return NULL;
         }
 
+	data->window = window;
+
 	/* Get the widgets. */
 
 	data->dialog = glade_xml_get_widget (data->gui, "comments_dialog");

Modified: branches/gthumb-2-10/src/dlg-duplicates.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-duplicates.c	(original)
+++ branches/gthumb-2-10/src/dlg-duplicates.c	Wed Apr  8 00:54:57 2009
@@ -768,15 +768,15 @@
 
 	data = g_new0 (DialogData, 1);
 
-	data->browser = browser;
-	data->gui = glade_xml_new (GTHUMB_GLADEDIR "/" GLADE_FILE, NULL,
-				   NULL);
-
+	data->gui = glade_xml_new (GTHUMB_GLADEDIR "/" GLADE_FILE, NULL, NULL);
 	if (! data->gui) {
 		g_warning ("Could not find " GLADE_FILE "\n");
+		g_free (data);
 		return;
 	}
 
+	data->browser = browser;
+
 	/* Get the widgets. */
 
 	data->dialog = glade_xml_get_widget (data->gui, "duplicates_dialog");

Modified: branches/gthumb-2-10/src/dlg-png-exporter.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-png-exporter.c	(original)
+++ branches/gthumb-2-10/src/dlg-png-exporter.c	Wed Apr  8 00:54:57 2009
@@ -1330,6 +1330,7 @@
 	data->gui = glade_xml_new (GTHUMB_GLADEDIR "/" GLADE_EXPORTER_FILE, NULL, NULL);
         if (!data->gui) {
                 g_warning ("Could not find " GLADE_EXPORTER_FILE "\n");
+		g_free (data);
                 return;
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]