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

If compiled with memory-debugging, write garbage to memory when it is freed. Fix for #1594. (CVS 2900)

FossilOrigin-Name: bd02a6faefa3602d0b93d54bc57809a2222d5903
This commit is contained in:
danielk1977
2006-01-10 07:14:23 +00:00
parent bdd6da23cd
commit 311019be0b
7 changed files with 44 additions and 31 deletions

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.320 2006/01/09 16:12:05 danielk1977 Exp $
** $Id: main.c,v 1.321 2006/01/10 07:14:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -139,6 +139,9 @@ int sqlite3_close(sqlite3 *db){
if( pDb->pBt ){
sqlite3BtreeClose(pDb->pBt);
pDb->pBt = 0;
if( j!=1 ){
pDb->pSchema = 0;
}
}
}
sqlite3ResetInternalSchema(db, 0);
@@ -165,7 +168,15 @@ int sqlite3_close(sqlite3 *db){
}
db->magic = SQLITE_MAGIC_ERROR;
/* The temp-database schema is allocated differently from the other schema
** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()).
** So it needs to be freed here. Todo: Why not roll the temp schema into
** the same sqliteMalloc() as the one that allocates the database
** structure?
*/
sqliteFree(db->aDb[1].pSchema);
sqliteFree(db);
sqlite3MallocAllow();
return SQLITE_OK;