[PATCH] Re: PATCH: anti memleak part 1



Fix minor memory leak in src/address-book-config.c.  Patch against 
current cvs.
diff -Nur --exclude=CVS --exclude=gtkhtml balsa-cvs/src/address-book-config.c balsa-temp/src/address-book-config.c
--- balsa-cvs/src/address-book-config.c	Thu Oct 18 21:09:50 2001
+++ balsa-temp/src/address-book-config.c	Sat Oct 20 10:26:46 2001
@@ -189,12 +189,14 @@
 					       (abc->ab_specific.vcard.path), FALSE);
 	    if (path != NULL) 
 		address_book = libbalsa_address_book_vcard_new(name, path);
+            g_free(path);
 	} else if (abc->create_type == LIBBALSA_TYPE_ADDRESS_BOOK_LDIF) {
 	    gchar *path =
 		gnome_file_entry_get_full_path(GNOME_FILE_ENTRY
 					       (abc->ab_specific.ldif.path), FALSE);
 	    if (path != NULL)
 		address_book = libbalsa_address_book_ldif_new(name, path);
+            g_free(path);
 #ifdef ENABLE_LDAP
 	} else if (abc->create_type == LIBBALSA_TYPE_ADDRESS_BOOK_LDAP) {
 	    gchar *host_name =
@@ -226,7 +228,7 @@
 	    vcard = LIBBALSA_ADDRESS_BOOK_VCARD(address_book);
 	    if (path) {
 		g_free(vcard->path);
-		vcard->path = g_strdup(path);
+		vcard->path = path;
 	    }
 	} else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book)) {
 	    LibBalsaAddressBookLdif *ldif;
@@ -238,7 +240,7 @@
 	    ldif = LIBBALSA_ADDRESS_BOOK_LDIF(address_book);
 	    if (path) {
 		g_free(ldif->path);
-		ldif->path = g_strdup(path);
+		ldif->path = path;
 	    }
 #ifdef ENABLE_LDAP
 	} else if (LIBBALSA_IS_ADDRESS_BOOK_LDAP(address_book)) {


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