1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Use the DbMalloc() and DbRealloc() functions more consistently. (CVS 4323)

FossilOrigin-Name: c790c234c369c6b7610e67dcaaa9eee347df729c
This commit is contained in:
danielk1977
2007-08-29 14:06:22 +00:00
parent f53e9b5ad5
commit 26783a58e2
12 changed files with 59 additions and 52 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to help implement virtual tables.
**
** $Id: vtab.c,v 1.55 2007/08/29 12:31:29 danielk1977 Exp $
** $Id: vtab.c,v 1.56 2007/08/29 14:06:23 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"
@@ -136,7 +136,7 @@ static void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){
int i = pTable->nModuleArg++;
int nBytes = sizeof(char *)*(1+pTable->nModuleArg);
char **azModuleArg;
azModuleArg = sqlite3_realloc(pTable->azModuleArg, nBytes);
azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes);
if( azModuleArg==0 ){
int j;
for(j=0; j<i; j++){
@@ -145,7 +145,6 @@ static void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){
sqlite3_free(zArg);
sqlite3_free(pTable->azModuleArg);
pTable->nModuleArg = 0;
db->mallocFailed = 1;
}else{
azModuleArg[i] = zArg;
azModuleArg[i+1] = 0;
@@ -469,9 +468,8 @@ static int addToVTrans(sqlite3 *db, sqlite3_vtab *pVtab){
if( (db->nVTrans%ARRAY_INCR)==0 ){
sqlite3_vtab **aVTrans;
int nBytes = sizeof(sqlite3_vtab *) * (db->nVTrans + ARRAY_INCR);
aVTrans = sqlite3_realloc((void *)db->aVTrans, nBytes);
aVTrans = sqlite3DbRealloc(db, (void *)db->aVTrans, nBytes);
if( !aVTrans ){
db->mallocFailed = 1;
return SQLITE_NOMEM;
}
memset(&aVTrans[db->nVTrans], 0, sizeof(sqlite3_vtab *)*ARRAY_INCR);