lib: do not leak the database in compaction
authorJani Nikula <jani@nikula.org>
Sun, 3 Nov 2013 12:24:44 +0000 (14:24 +0200)
committerDavid Bremner <david@tethera.net>
Thu, 7 Nov 2013 10:46:25 +0000 (06:46 -0400)
Destroy instead of close the database after compaction, and also on
error path, to not leak the database.

lib/database.cc

index 7a8702e263c46985bb21818d3f8dd039e39799d6..eadf8a763395187afccd18cefad47e1cca8d2650 100644 (file)
@@ -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