[PATCH v2 04/11] lib: do not leak the database in compaction

Jani Nikula jani at nikula.org
Sun Nov 3 04:24:44 PST 2013


Destroy instead of close the database after compaction, and also on
error path, to not leak the database.
---
 lib/database.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 7a8702e..eadf8a7 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -941,10 +941,12 @@ notmuch_database_compact (const char* path,
 	goto DONE;
     }
 
-    notmuch_database_close(notmuch);
-
 DONE:
+    if (notmuch)
+	notmuch_database_destroy (notmuch);
+
     talloc_free(local);
+
     return ret;
 }
 #else
-- 
1.8.4.rc3



More information about the notmuch mailing list