mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Minor changes (mainly to assert() macros) to handle malloc failure in vtab operations. (CVS 3851)
FossilOrigin-Name: 175156d1fcaadab3b955597abb27f6b9043bbb5b
This commit is contained in:
10
src/vtab.c
10
src/vtab.c
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** This file contains code used to help implement virtual tables.
|
||||
**
|
||||
** $Id: vtab.c,v 1.41 2007/04/16 15:49:41 danielk1977 Exp $
|
||||
** $Id: vtab.c,v 1.42 2007/04/18 14:24:34 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
#include "sqliteInt.h"
|
||||
@@ -311,6 +311,10 @@ static int vtabCallConstructor(
|
||||
char *zErr = 0;
|
||||
char *zModuleName = sqlite3MPrintf("%s", pTab->zName);
|
||||
|
||||
if( !zModuleName ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
assert( !db->pVTab );
|
||||
assert( xConstruct );
|
||||
|
||||
@@ -471,6 +475,7 @@ int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
|
||||
pTab->nCol = sParse.pNewTable->nCol;
|
||||
sParse.pNewTable->nCol = 0;
|
||||
sParse.pNewTable->aCol = 0;
|
||||
db->pVTab = 0;
|
||||
} else {
|
||||
sqlite3Error(db, SQLITE_ERROR, zErr);
|
||||
sqliteFree(zErr);
|
||||
@@ -481,10 +486,9 @@ int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
|
||||
sqlite3_finalize((sqlite3_stmt*)sParse.pVdbe);
|
||||
sqlite3DeleteTable(sParse.pNewTable);
|
||||
sParse.pNewTable = 0;
|
||||
db->pVTab = 0;
|
||||
|
||||
assert( (rc&0xff)==rc );
|
||||
return rc;
|
||||
return sqlite3ApiExit(db, rc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user