[PATCH v2 03/11] lib: check talloc success in compact

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


In line with the allocation checks all around.
---
 lib/database.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/database.cc b/lib/database.cc
index 3dfea0f..7a8702e 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -863,13 +863,17 @@ notmuch_database_compact (const char* path,
 			  const char* backup_path,
 			  notmuch_compact_status_cb_t status_cb)
 {
-    void *local = talloc_new (NULL);
+    void *local;
     char *notmuch_path, *xapian_path, *compact_xapian_path;
     char *old_xapian_path = NULL;
     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
     notmuch_database_t *notmuch = NULL;
     struct stat statbuf;
 
+    local = talloc_new (NULL);
+    if (! local)
+	return NOTMUCH_STATUS_OUT_OF_MEMORY;
+
     ret = notmuch_database_open(path, NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch);
     if (ret) {
 	goto DONE;
-- 
1.8.4.rc3



More information about the notmuch mailing list