[evolution-patches] Patch to fix large memory leak in addressbook

Ross Burton ross@burtonini.com
Fri May 13 15:41:27 EDT 2005


--=-bt+dA4CMsky1dbyg0eDo
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi,

The address book backend suffers from quite a nasty memory leak which
means that in normal use the berkley addressbook backend will leak
contacts left, right, and centre.

The attached patch is wonderfully trivial and fixes the leaks.

Ross
-- 
Ross Burton                                 mail: ross@burtonini.com
                                          jabber: ross@burtonini.com
                                     www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF


--=-bt+dA4CMsky1dbyg0eDo
Content-Disposition: attachment; filename=file-backend-close.diff
Content-Type: text/x-patch; name=file-backend-close.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit

Index: addressbook/backends/file/e-book-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/backends/file/e-book-backend-file.c,v
retrieving revision 1.31
diff -u -r1.31 e-book-backend-file.c
--- addressbook/backends/file/e-book-backend-file.c	26 Apr 2005 08:56:58 -0000	1.31
+++ addressbook/backends/file/e-book-backend-file.c	13 May 2005 14:40:34 -0000
@@ -128,6 +128,8 @@
 		db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_NEXT);
 
 	}
+
+	dbc->c_close (dbc);
 }
 
 static char *
@@ -450,6 +452,11 @@
 		status = db_error != DB_NOTFOUND
 			? GNOME_Evolution_Addressbook_OtherError
 			: GNOME_Evolution_Addressbook_Success;
+
+		db_error = dbc->c_close(dbc);
+		if (db_error != 0) {
+			g_warning("Could not close cursor: %d", db_error);
+		}
 	}
 
 	*contacts = contact_list;

--=-bt+dA4CMsky1dbyg0eDo--




More information about the evolution-patches mailing list