summaryrefslogtreecommitdiffstats
path: root/notmuch-reindex.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2019-04-15 22:46:15 -0300
committerDavid Bremner <david@tethera.net>2019-04-18 22:15:44 -0300
commit08cd2e57bb3de3922ba54ad95c1e8e85a131330c (patch)
treebbb4b26a686153c01ce9930c5f8c1be2deeadf18 /notmuch-reindex.c
parent319dd95ebbd841320e269d34e67a824876f8426a (diff)
CLI/reindex: fix memory leak
Since message is owned by messages, it was held for the entire run of the program. This in turn means that the Xapian::Document objects are not freed, and thus one ends up with (effectively) a copy of one's entire mailstore in memory when running notmuch reindex '*' Thanks to Olly Betts for the patient help debugging, and the suggestion of a fix.
Diffstat (limited to 'notmuch-reindex.c')
-rw-r--r--notmuch-reindex.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/notmuch-reindex.c b/notmuch-reindex.c
index d8589120..fefa7c63 100644
--- a/notmuch-reindex.c
+++ b/notmuch-reindex.c
@@ -71,6 +71,7 @@ reindex_query (notmuch_database_t *notmuch, const char *query_string,
ret = notmuch_message_reindex(message, indexopts);
if (ret != NOTMUCH_STATUS_SUCCESS)
break;
+ notmuch_message_destroy (message);
}
if (!ret)