aboutsummaryrefslogtreecommitdiff
path: root/src/wherecode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wherecode.c')
-rw-r--r--src/wherecode.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index 0b1165f02..0524ae277 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -442,11 +442,6 @@ static int codeEqualityTerm(
if( ALWAYS(pLoop->aLTerm[i]) && pLoop->aLTerm[i]->pExpr==pX ) nEq++;
}
- if( nEq>1 ){
- aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int) * nEq);
- if( !aiMap ) return 0;
- }
-
if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0);
}else{
@@ -475,9 +470,12 @@ static int codeEqualityTerm(
pX->pLeft = pLhs->a[0].pExpr;
}else{
pLeft->x.pList = pLhs;
+ aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int) * nEq);
+ testcase( aiMap==0 );
}
pX->x.pSelect->pEList = pRhs;
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap);
+ testcase( aiMap!=0 && aiMap[0]!=0 );
pX->x.pSelect->pEList = pOrigRhs;
pLeft->x.pList = pOrigLhs;
pX->pLeft = pLeft;