1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Fix a problem where a file was not being closed after a malloc() failure. (CVS 1741)

FossilOrigin-Name: 3c8512bc549e10ee131cb7f2d4e74d96e9de74a0
This commit is contained in:
danielk1977
2004-06-26 13:51:33 +00:00
parent 3dea76474c
commit b5548a8b20
5 changed files with 53 additions and 19 deletions

View File

@@ -126,6 +126,8 @@ int sqlite3VdbeOp3(Vdbe *p, int op, int p1, int p2, const char *zP3,int p3type){
** The VDBE knows that a P2 value is a label because labels are
** always negative and P2 values are suppose to be non-negative.
** Hence, a negative P2 value is a label that has yet to be resolved.
**
** Zero is returned if a malloc() fails.
*/
int sqlite3VdbeMakeLabel(Vdbe *p){
int i;
@@ -1309,17 +1311,15 @@ int sqlite3VdbeReset(Vdbe *p){
** the result code. Write any error message text into *pzErrMsg.
*/
int sqlite3VdbeFinalize(Vdbe *p){
int rc;
int rc = SQLITE_OK;
sqlite *db;
if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){
if( p->magic==VDBE_MAGIC_INIT ){
sqlite3Error(p->db, SQLITE_MISUSE, 0);
}
if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){
rc = sqlite3VdbeReset(p);
}else if( p->magic!=VDBE_MAGIC_INIT ){
/* sqlite3Error(p->db, SQLITE_MISUSE, 0); */
return SQLITE_MISUSE;
}
db = p->db;
rc = sqlite3VdbeReset(p);
sqlite3VdbeDelete(p);
if( rc==SQLITE_SCHEMA ){
sqlite3ResetInternalSchema(db, 0);