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

Fix a memory leak that could occur during error-state recovery. (CVS 4457)

FossilOrigin-Name: 3d1d13d1eb5817c22956e6e7792783116a828962
This commit is contained in:
danielk1977
2007-10-03 15:22:25 +00:00
parent 2a180ff9c5
commit c4f6f62900
3 changed files with 13 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.391 2007/10/03 08:46:45 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.392 2007/10/03 15:22:26 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -1270,10 +1270,14 @@ static void pager_unlock(Pager *pPager){
pager_reset(pPager);
if( pPager->stmtOpen ){
sqlite3OsClose(pPager->stfd);
sqlite3_free(pPager->aInStmt);
pPager->aInStmt = 0;
}
if( pPager->journalOpen ){
sqlite3OsClose(pPager->jfd);
pPager->journalOpen = 0;
sqlite3_free(pPager->aInJournal);
pPager->aInJournal = 0;
}
pPager->stmtOpen = 0;
pPager->stmtInUse = 0;
@@ -4772,6 +4776,7 @@ static int pagerStmtBegin(Pager *pPager){
}
assert( pPager->journalOpen );
pagerLeave(pPager);
assert( pPager->aInStmt==0 );
pPager->aInStmt = sqlite3MallocZero( pPager->dbSize/8 + 1 );
pagerEnter(pPager);
if( pPager->aInStmt==0 ){