[PATCH 2/3] lib: Release resources if notmuch_database_open fails

Austin Clements amdragon at MIT.EDU
Sat Jan 28 21:50:09 PST 2012


Previously, if a Xapian exception occurred in notmuch_database_open,
we failed to clean up the allocated notmuch_database_t object.
---
 lib/database.cc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index a6d15a1..94022d7 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -703,6 +703,7 @@ notmuch_database_open (const char *path,
     } catch (const Xapian::Error &error) {
 	fprintf (stderr, "A Xapian exception occurred opening database: %s\n",
 		 error.get_msg().c_str());
+	notmuch_database_close (notmuch);
 	notmuch = NULL;
     }
 
-- 
1.7.7.3



More information about the notmuch mailing list