aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2008-11-21 16:58:03 +0000
committerdanielk1977 <danielk1977@noemail.net>2008-11-21 16:58:03 +0000
commit6c359f071dba94b5f5babffe8c84633f655c521f (patch)
tree617ecb21e780f665d3df74131ea82b89e817e30f /src
parentf730075312add8cbd9c0c53e0a630264a12cdda5 (diff)
downloadsqlite-6c359f071dba94b5f5babffe8c84633f655c521f.tar.gz
sqlite-6c359f071dba94b5f5babffe8c84633f655c521f.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/vdbeaux.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 7d3b713f8..b3710e994 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -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 );