]> git.sesse.net Git - plocate/commitdiff
Fix a harmless memory leak in plocate-build.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Thu, 8 Oct 2020 20:52:47 +0000 (22:52 +0200)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Thu, 8 Oct 2020 20:53:43 +0000 (22:53 +0200)
plocate-build.cpp

index be8a818a868e9f796dd836361349c6031c684467..c571b0981b32bfb89328320114a5e61f5f52c100 100644 (file)
@@ -147,6 +147,12 @@ public:
                : invindex(new PostingListBuilder *[NUM_TRIGRAMS]), outfp(outfp), block_size(block_size) {
                fill(invindex.get(), invindex.get() + NUM_TRIGRAMS, nullptr);
        }
+       ~Corpus() {
+               for (unsigned i = 0; i < NUM_TRIGRAMS; ++i) {
+                       delete invindex[i];
+               }
+       }
+
        void add_file(string filename);
        void flush_block();