From: Teodor Sigaev Date: Tue, 28 Jul 2009 09:33:09 +0000 (+0000) Subject: Fix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by X-Git-Tag: REL8_2_14~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a142498e76a74b64ea03b13809db96c7c5e6f62e;p=thirdparty%2Fpostgresql.git Fix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by Aaron Marcuse-Kubitza --- diff --git a/contrib/tsearch2/query_rewrite.c b/contrib/tsearch2/query_rewrite.c index 63d8140a6c2..2b917373112 100644 --- a/contrib/tsearch2/query_rewrite.c +++ b/contrib/tsearch2/query_rewrite.c @@ -174,12 +174,12 @@ dropvoidsubtree(QTNode * root) root->nchild = j; - if (root->valnode->val == (int4) '!' && root->nchild == 0) + if (root->nchild == 0) { QTNFree(root); root = NULL; } - else if (root->nchild == 1) + else if (root->nchild == 1 && root->valnode->val != (int4) '!') { QTNode *nroot = root->child[0];