1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Fix a null-pointer dereference that can occur on an OOM error while running

ANALYZE with SQLITE_ENABLE_STAT2.

FossilOrigin-Name: 73128d4ef5d7703bf7af0553c307b55dc1b783f6
This commit is contained in:
drh
2011-01-04 20:06:33 +00:00
parent 4856698fa5
commit 65a0ce16aa
3 changed files with 15 additions and 12 deletions

View File

@@ -636,8 +636,11 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
if( rc==SQLITE_OK ){
while( sqlite3_step(pStmt)==SQLITE_ROW ){
char *zIndex = (char *)sqlite3_column_text(pStmt, 0);
Index *pIdx = sqlite3FindIndex(db, zIndex, sInfo.zDatabase);
char *zIndex; /* Index name */
Index *pIdx; /* Pointer to the index object */
zIndex = (char *)sqlite3_column_text(pStmt, 0);
pIdx = zIndex ? sqlite3FindIndex(db, zIndex, sInfo.zDatabase) : 0;
if( pIdx ){
int iSample = sqlite3_column_int(pStmt, 1);
if( iSample<SQLITE_INDEX_SAMPLES && iSample>=0 ){