aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2009-08-25 15:56:51 +0000
committerdrh <drh@noemail.net>2009-08-25 15:56:51 +0000
commit011cfca18e23b6b5d34837ef8deab40d1a52800b (patch)
tree6497102400dbdd4ec39699d5abdece0cd2cfe056 /src
parent333ceb9389966f14435e4d53b390a6a238a00feb (diff)
downloadsqlite-011cfca18e23b6b5d34837ef8deab40d1a52800b.tar.gz
sqlite-011cfca18e23b6b5d34837ef8deab40d1a52800b.zip
Initialize variables differently in the range processing logic of where.c
in order to make sure variables are always initialized even following an OOM error. FossilOrigin-Name: 3fb3686a4502140720dc3710a28a4f4128ab6554
Diffstat (limited to 'src')
-rw-r--r--src/where.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/where.c b/src/where.c
index 836324156..ba4cb8072 100644
--- a/src/where.c
+++ b/src/where.c
@@ -2038,8 +2038,8 @@ static int whereRangeScanEst(
if( nEq==0 && p->aSample ){
int iEst;
- int iUpper;
- int iLower;
+ int iLower = 0;
+ int iUpper = SQLITE_INDEX_SAMPLES;
u8 aff = p->pTable->aCol[0].affinity;
if( pLower ){
@@ -2057,17 +2057,14 @@ static int whereRangeScanEst(
goto range_est_fallback;
}else if( pLowerVal==0 ){
rc = whereRangeRegion(pParse, p, pUpperVal, &iUpper);
- iLower = pLower ? iUpper/2 : 0;
+ if( pLower ) iLower = iUpper/2;
}else if( pUpperVal==0 ){
rc = whereRangeRegion(pParse, p, pLowerVal, &iLower);
- iUpper = pUpper ? (iLower + SQLITE_INDEX_SAMPLES + 1)/2
- : SQLITE_INDEX_SAMPLES;
+ if( pUpper ) iUpper = (iLower + SQLITE_INDEX_SAMPLES + 1)/2;
}else{
rc = whereRangeRegion(pParse, p, pUpperVal, &iUpper);
if( rc==SQLITE_OK ){
rc = whereRangeRegion(pParse, p, pLowerVal, &iLower);
- }else{
- iLower = 0;
}
}