Fix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by

Aaron Marcuse-Kubitza <aaronmk@blackducksoftware.com>
This commit is contained in:
Teodor Sigaev 2009-07-28 09:31:55 +00:00
parent c1b9ec24ef
commit 1f4b046c18
1 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_rewrite.c,v 1.15 2009/07/16 06:33:44 petere Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_rewrite.c,v 1.16 2009/07/28 09:31:55 teodor Exp $
*
*-------------------------------------------------------------------------
*/
@ -217,12 +217,12 @@ dropvoidsubtree(QTNode *root)
root->nchild = j;
if (root->valnode->qoperator.oper == OP_NOT && root->nchild == 0)
if (root->nchild == 0)
{
QTNFree(root);
root = NULL;
}
else if (root->nchild == 1)
else if (root->nchild == 1 && root->valnode->qoperator.oper != OP_NOT)
{
QTNode *nroot = root->child[0];