]> git.notmuchmail.org Git - notmuch/commitdiff
CLI/reindex: fix memory leak
authorDavid Bremner <david@tethera.net>
Tue, 16 Apr 2019 01:46:15 +0000 (22:46 -0300)
committerDavid Bremner <david@tethera.net>
Fri, 19 Apr 2019 01:15:44 +0000 (22:15 -0300)
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.

notmuch-reindex.c

index d8589120cae94ed4fa4efa1c3cfdda9520d5697d..fefa7c63c64deec1ad6beb8c412acf9cdb897fb7 100644 (file)
@@ -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)