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

Fix another memory leak in the pager. (CVS 2425)

FossilOrigin-Name: 4ca11ca015d798655170593c1b76d312185d6ed2
This commit is contained in:
drh
2005-03-28 18:04:27 +00:00
parent 6cdc5d0269
commit 88b01a13c6
3 changed files with 11 additions and 8 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.200 2005/03/28 08:44:07 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.201 2005/03/28 18:04:28 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -913,6 +913,7 @@ static int pager_unwritelock(Pager *pPager){
pPager->dirtyCache = 0;
pPager->nRec = 0;
}else{
assert( pPager->aInJournal==0 );
assert( pPager->dirtyCache==0 || pPager->useJournal==0 );
}
rc = sqlite3OsUnlock(&pPager->fd, SHARED_LOCK);
@@ -1985,6 +1986,7 @@ int sqlite3pager_close(Pager *pPager){
if( pPager->journalOpen ){
sqlite3OsClose(&pPager->jfd);
}
sqliteFree(pPager->aInJournal);
if( pPager->stmtOpen ){
sqlite3OsClose(&pPager->stfd);
}
@@ -2618,6 +2620,7 @@ static int pager_open_journal(Pager *pPager){
assert( pPager->state>=PAGER_RESERVED );
assert( pPager->journalOpen==0 );
assert( pPager->useJournal );
assert( pPager->aInJournal==0 );
sqlite3pager_pagecount(pPager);
pPager->aInJournal = sqliteMalloc( pPager->dbSize/8 + 1 );
if( pPager->aInJournal==0 ){