1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Fix a couple of errors in WAL code that can occur in an OOM situation.

FossilOrigin-Name: 9d3f3736be42ef8ab48b099d4712e08dfca97873
This commit is contained in:
dan
2010-05-03 17:18:24 +00:00
parent 4c846bb148
commit 76ed3bc044
5 changed files with 67 additions and 43 deletions

View File

@@ -4972,8 +4972,8 @@ static int unixShmOpen(
nName = strlen(zName);
pNew = sqlite3_malloc( sizeof(*pFile) + nName + 10 );
if( pNew==0 ){
rc = SQLITE_NOMEM;
goto shm_open_err;
sqlite3_free(p);
return SQLITE_NOMEM;
}
memset(pNew, 0, sizeof(*pNew));
pNew->zFilename = (char*)&pNew[1];
@@ -5059,9 +5059,8 @@ static int unixShmOpen(
/* Jump here on any error */
shm_open_err:
unixShmPurge();
unixShmPurge(); /* This call frees pFile if required */
sqlite3_free(p);
sqlite3_free(pFile);
sqlite3_free(pNew);
*pShm = 0;
unixLeaveMutex();