1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Fix the OOM handling for explain statements so that it is the same as for regular statements if the OOM error occurs from within a call to sqlite3_column_text() or text16(). (CVS 5941)

FossilOrigin-Name: 891b14e138c4d6cac0dfb234d8aedc5dabe376ab
This commit is contained in:
danielk1977
2008-11-21 16:58:03 +00:00
parent f730075312
commit 6c359f071d
3 changed files with 16 additions and 9 deletions

View File

@@ -14,7 +14,7 @@
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
**
** $Id: vdbeaux.c,v 1.420 2008/11/17 19:18:55 danielk1977 Exp $
** $Id: vdbeaux.c,v 1.421 2008/11/21 16:58:03 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -836,7 +836,7 @@ int sqlite3VdbeList(
assert( p->explain );
if( p->magic!=VDBE_MAGIC_RUN ) return SQLITE_MISUSE;
assert( db->magic==SQLITE_MAGIC_BUSY );
assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY );
assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );
/* Even though this opcode does not use dynamic strings for
** the result, result columns may become dynamic if the user calls
@@ -844,6 +844,13 @@ int sqlite3VdbeList(
*/
releaseMemArray(pMem, p->nMem);
if( p->rc==SQLITE_NOMEM ){
/* This happens if a malloc() inside a call to sqlite3_column_text() or
** sqlite3_column_text16() failed. */
db->mallocFailed = 1;
return SQLITE_ERROR;
}
do{
i = p->pc++;
}while( i<p->nOp && p->explain==2 && p->aOp[i].opcode!=OP_Explain );