[balsa] do not leak gtk_file_chooser_get_filename value



commit ff0d4f76e70e73b214542b3a72c16b33e42282c8
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Apr 26 10:02:46 2009 -0400

    do not leak gtk_file_chooser_get_filename value
---
 src/address-book-config.c |    2 ++
 src/mailbox-conf.c        |    7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/address-book-config.c b/src/address-book-config.c
index 5e70827..569140e 100644
--- a/src/address-book-config.c
+++ b/src/address-book-config.c
@@ -622,6 +622,8 @@ create_book(AddressBookConfig * abc)
         if (load != NULL && save != NULL)
             address_book =
                 libbalsa_address_book_externq_new(name, load, save);
+        g_free(load);
+        g_free(save);
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDIF) {
         gchar *path =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(abc->window));
diff --git a/src/mailbox-conf.c b/src/mailbox-conf.c
index 154dc20..9e108d8 100644
--- a/src/mailbox-conf.c
+++ b/src/mailbox-conf.c
@@ -977,13 +977,12 @@ mailbox_conf_add(MailboxConfWindow * mcw)
     if ( LIBBALSA_IS_MAILBOX_LOCAL(mcw->mailbox) ) {
 	LibBalsaMailboxLocal *ml  = LIBBALSA_MAILBOX_LOCAL(mcw->mailbox);
 	gchar *path;
-	int res;
 
         path =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(mcw->window));
-	res = libbalsa_mailbox_local_set_path(ml, path, TRUE);
 
-	if( res != 0) {
+        if (libbalsa_mailbox_local_set_path(ml, path, TRUE) != 0) {
+            g_free(path);
 	    g_object_unref(G_OBJECT(mcw->mailbox));
 	    mcw->mailbox = NULL;
 	    return;
@@ -994,6 +993,8 @@ mailbox_conf_add(MailboxConfWindow * mcw)
                                         balsa_app.local_mail_directory);
         printf("Save to config: %d\n", save_to_config);
 	mcw->mailbox->name = g_path_get_basename(path);
+        g_free(path);
+
 	balsa_mailbox_local_append(mcw->mailbox);
     }
     mbnode = balsa_mailbox_node_new_from_mailbox(mcw->mailbox);



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