diff options
Diffstat (limited to 'src/vdbeapi.c')
-rw-r--r-- | src/vdbeapi.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 2ef0d3c11..808d496c3 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -175,7 +175,8 @@ static int sqlite3Step(Vdbe *p){ int rc; /* Assert that malloc() has not failed */ - assert( !sqlite3MallocFailed() ); + db = p->db; + assert( !db->mallocFailed ); if( p==0 || p->magic!=VDBE_MAGIC_RUN ){ return SQLITE_MISUSE; @@ -190,7 +191,6 @@ static int sqlite3Step(Vdbe *p){ rc = SQLITE_ERROR; goto end_of_step; } - db = p->db; if( sqlite3SafetyOn(db) ){ p->rc = SQLITE_MISUSE; return SQLITE_MISUSE; @@ -358,7 +358,7 @@ void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){ pMem->z = pMem->zShort; memset(pMem->z, 0, nByte); }else{ - pMem->z = sqliteMalloc( nByte ); + pMem->z = sqlite3DbMallocZero(p->db, nByte); } } } @@ -395,8 +395,11 @@ void sqlite3_set_auxdata( pVdbeFunc = pCtx->pVdbeFunc; if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){ int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg; - pVdbeFunc = sqliteRealloc(pVdbeFunc, nMalloc); - if( !pVdbeFunc ) goto failed; + pVdbeFunc = sqlite3_realloc(pVdbeFunc, nMalloc); + if( !pVdbeFunc ){ + pCtx->db->mallocFailed = 1; + goto failed; + } pCtx->pVdbeFunc = pVdbeFunc; memset(&pVdbeFunc->apAux[pVdbeFunc->nAux], 0, sizeof(struct AuxData)*(iArg+1-pVdbeFunc->nAux)); |