diff options
author | drh <drh@noemail.net> | 2007-08-16 04:30:38 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-08-16 04:30:38 +0000 |
commit | 174357527a47e97f3d782c1327be6dfd48f7082f (patch) | |
tree | 846ccc36dd9fae23e6c33b52686b4f742ca7640d /src/vdbeapi.c | |
parent | 0e6f1546b05fd04fb3b3e963df948259683deee4 (diff) | |
download | sqlite-174357527a47e97f3d782c1327be6dfd48f7082f.tar.gz sqlite-174357527a47e97f3d782c1327be6dfd48f7082f.zip |
Half-way through a major refactoring of the memory allocation.
I have not even attempted to compile so I am certain there are
countless errors. (CVS 4231)
FossilOrigin-Name: deb7ecd65f7b83eaf0ba610eeef3b0ede61db1c3
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)); |