]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts-lucene: Fix potential memory leak
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 17 Nov 2017 18:55:55 +0000 (20:55 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 17 Nov 2017 18:55:55 +0000 (20:55 +0200)
src/plugins/fts-lucene/lucene-wrapper.cc

index 9d5840d63412fdfedb1fdd3159ae1e8e3c3e7506..68d25c78c7c1999d9955ad28e1633b5020c0bd1a 100644 (file)
@@ -1210,13 +1210,13 @@ lucene_add_definite_query(struct lucene_index *index,
 
        switch (arg->type) {
        case SEARCH_TEXT: {
-               BooleanQuery *bq = _CLNEW BooleanQuery();
                Query *q1 = lucene_get_query(index, _T("hdr"), arg);
                Query *q2 = lucene_get_query(index, _T("body"), arg);
 
                if (q1 == NULL && q2 == NULL)
                        q = NULL;
                else {
+                       BooleanQuery *bq = _CLNEW BooleanQuery();
                        if (q1 != NULL)
                                bq->add(q1, true, BooleanClause::SHOULD);
                        if (q2 != NULL)