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

Ensure the database attached as part of VACUUM can be detached successfully after a malloc() failure. (CVS 2918)

FossilOrigin-Name: 8c26893c65574b0667bb84bde3ca49751079cc8d
This commit is contained in:
danielk1977
2006-01-11 16:10:20 +00:00
parent b82e7edae9
commit 0203bde908
4 changed files with 18 additions and 30 deletions

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.166 2006/01/10 15:18:28 drh Exp $
** $Id: util.c,v 1.167 2006/01/11 16:10:20 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -438,6 +438,7 @@ static void * OSMALLOC(int n){
ThreadData *pTsd = sqlite3ThreadData();
pTsd->nMaxAlloc = MAX(pTsd->nMaxAlloc, pTsd->nAlloc);
#endif
assert( sqlite3ThreadData()->mallocAllowed );
if( !failMalloc() ){
u32 *p;
p = (u32 *)sqlite3OsMalloc(n + TESTALLOC_OVERHEAD);
@@ -479,6 +480,7 @@ static void * OSREALLOC(void *pRealloc, int n){
ThreadData *pTsd = sqlite3ThreadData();
pTsd->nMaxAlloc = MAX(pTsd->nMaxAlloc, pTsd->nAlloc);
#endif
assert( sqlite3ThreadData()->mallocAllowed );
if( !failMalloc() ){
u32 *p = (u32 *)getOsPointer(pRealloc);
checkGuards(p);