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

Include the ThreadData structure in internal malloc() testing. Also fixes for revealed bugs. (CVS 2974)

FossilOrigin-Name: c7b9d50d0a975912776aaa2b870308652f77e1e6
This commit is contained in:
danielk1977
2006-01-18 18:22:43 +00:00
parent 757b04ed36
commit 76e8d1a292
10 changed files with 92 additions and 59 deletions

View File

@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema
** from disk.
**
** $Id: prepare.c,v 1.26 2006/01/18 16:51:35 danielk1977 Exp $
** $Id: prepare.c,v 1.27 2006/01/18 18:22:43 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -520,6 +520,9 @@ int sqlite3_prepare(
memset(&sParse, 0, sizeof(sParse));
sParse.db = db;
sParse.pTsd = sqlite3ThreadData();
if( !sParse.pTsd ){
goto prepare_out;
}
sParse.pTsd->nRef++;
sqlite3RunParser(&sParse, zSql, &zErrMsg);
@@ -554,6 +557,7 @@ int sqlite3_prepare(
}
#endif
prepare_out:
if( sqlite3SafetyOff(db) ){
rc = SQLITE_MISUSE;
}
@@ -570,7 +574,9 @@ int sqlite3_prepare(
sqlite3Error(db, rc, 0);
}
sParse.pTsd->nRef--;
if( sParse.pTsd ){
sParse.pTsd->nRef--;
}
rc = sqlite3ApiExit(db, rc);
sqlite3ReleaseThreadData();
return rc;