[evolution-patches] Patch for possible leaks in e-d-s



Found these from a valgrind log I sent Harish a week or so ago.

The e-book-backend-file.c changes look like they could be achieved in a
cleaner manner by using multiple goto: labels to clean up in each case?

Cheers
Kjartan

diff -u -p -r1.34 e-book-backend-file.c
--- addressbook/backends/file/e-book-backend-file.c     1 Jul 2005 05:17:00 -0000       1.34
+++ addressbook/backends/file/e-book-backend-file.c     5 Jul 2005 13:02:15 -0000
@@ -1056,6 +1056,7 @@ e_book_backend_file_load_source (EBookBa
        db_error = e_db3_utils_maybe_recover (filename);
        if (db_error != 0) {
                g_warning ("db recovery failed with %d", db_error);
+               g_free (filename);
                return GNOME_Evolution_Addressbook_OtherError;
        }

@@ -1068,6 +1069,7 @@ e_book_backend_file_load_source (EBookBa
                if (db_error != 0) {
                        g_warning ("db_env_create failed with %d", db_error);
                        g_static_mutex_unlock(&global_env_lock);
+                       g_free (filename);
                        return GNOME_Evolution_Addressbook_OtherError;
                }

@@ -1076,6 +1078,7 @@ e_book_backend_file_load_source (EBookBa
                        env->close(env, 0);
                        g_warning ("db_env_open failed with %d", db_error);
                        g_static_mutex_unlock(&global_env_lock);
+                       g_free (filename);
                        return GNOME_Evolution_Addressbook_OtherError;
                }

@@ -1091,6 +1094,7 @@ e_book_backend_file_load_source (EBookBa
        db_error = db_create (&db, env, 0);
        if (db_error != 0) {
                g_warning ("db_create failed with %d", db_error);
+               g_free (filename);
                return GNOME_Evolution_Addressbook_OtherError;
        }

@@ -1101,6 +1105,7 @@ e_book_backend_file_load_source (EBookBa

                if (db_error != 0) {
                        g_warning ("db format upgrade failed with %d", db_error);
+                       g_free (filename);
                        return GNOME_Evolution_Addressbook_OtherError;
                }

@@ -1122,6 +1127,7 @@ e_book_backend_file_load_source (EBookBa
                        rv = e_util_mkdir_hier (dirname, 0777);
                        if (rv == -1 && errno != EEXIST) {
                                g_warning ("failed to make directory %s: %s", dirname, strerror (errno));
+                               g_free (filename);
                                if (errno == EACCES || errno == EPERM)
                                        return GNOME_Evolution_Addressbook_PermissionDenied;
                                else
@@ -1148,6 +1154,7 @@ e_book_backend_file_load_source (EBookBa

        if (db_error != 0) {
                bf->priv->file_db = NULL;
+               g_free (filename);
                return GNOME_Evolution_Addressbook_OtherError;
        }

@@ -1155,6 +1162,7 @@ e_book_backend_file_load_source (EBookBa
                db->close (db, 0);
                bf->priv->file_db = NULL;
                g_warning ("e_book_backend_file_maybe_upgrade_db failed");
+               g_free (filename);
                return GNOME_Evolution_Addressbook_OtherError;
        }

Index: libedataserverui/e-source-option-menu.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-source-option-menu.c,v
retrieving revision 1.6
diff -u -p -r1.6 e-source-option-menu.c
--- libedataserverui/e-source-option-menu.c     4 May 2005 08:43:58 -0000       1.6
+++ libedataserverui/e-source-option-menu.c     5 Jul 2005 13:02:16 -0000
@@ -138,6 +138,7 @@ populate (ESourceOptionMenu *option_menu
                        ESource *source = E_SOURCE (q->data);
                        char *label = g_strconcat ("    ", e_source_peek_name (source), NULL);
                        GtkWidget *item = gtk_menu_item_new_with_label (label);
+                       g_free (label);

                        gtk_object_set_data_full (GTK_OBJECT (item), MENU_ITEM_SOURCE_DATA_ID, source,
                                                  (GtkDestroyNotify) g_object_unref);





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