aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test8.c4
-rw-r--r--src/where.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/src/test8.c b/src/test8.c
index fa26677fe..a313c2601 100644
--- a/src/test8.c
+++ b/src/test8.c
@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test8.c,v 1.77 2009/04/21 09:02:47 danielk1977 Exp $
+** $Id: test8.c,v 1.78 2009/04/29 11:50:54 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -695,7 +695,7 @@ static int echoFilter(
rc = sqlite3_prepare(db, idxStr, -1, &pCur->pStmt, 0);
assert( pCur->pStmt || rc!=SQLITE_OK );
for(i=0; rc==SQLITE_OK && i<argc; i++){
- sqlite3_bind_value(pCur->pStmt, i+1, argv[i]);
+ rc = sqlite3_bind_value(pCur->pStmt, i+1, argv[i]);
}
/* If everything was successful, advance to the first row of the scan */
diff --git a/src/where.c b/src/where.c
index f02689b3e..3f850d6d2 100644
--- a/src/where.c
+++ b/src/where.c
@@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
-** $Id: where.c,v 1.390 2009/04/24 15:46:22 drh Exp $
+** $Id: where.c,v 1.391 2009/04/29 11:50:54 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -1747,6 +1747,12 @@ static void bestVirtualIndex(
int i, j;
int nOrderBy;
+ /* Make sure wsFlags is initialized to some sane value. Otherwise, if the
+ ** malloc in allocateIndexInfo() fails and this function returns leaving
+ ** wsFlags in an uninitialized state, the caller may behave unpredictably.
+ */
+ pCost->plan.wsFlags = WHERE_VIRTUALTABLE;
+
/* If the sqlite3_index_info structure has not been previously
** allocated and initialized, then allocate and initialize it now.
*/
@@ -1830,7 +1836,6 @@ static void bestVirtualIndex(
}else{
pCost->rCost = pIdxInfo->estimatedCost;
}
- pCost->plan.wsFlags = WHERE_VIRTUALTABLE;
pCost->plan.u.pVtabIdx = pIdxInfo;
if( pIdxInfo && pIdxInfo->orderByConsumed ){
pCost->plan.wsFlags |= WHERE_ORDERBY;