1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Avoid leaving the malloc subsystem in a partially initialized state if

the low-level initialization callback fails.

FossilOrigin-Name: 3e872011ff5e27738c282f46d2b5803d94fe4b76
This commit is contained in:
drh
2015-03-26 17:04:23 +00:00
parent 21aa6a1acb
commit 592f0cb15e
3 changed files with 11 additions and 8 deletions

View File

@@ -162,6 +162,7 @@ void sqlite3_soft_heap_limit(int n){
** Initialize the memory allocation subsystem.
*/
int sqlite3MallocInit(void){
int rc;
if( sqlite3GlobalConfig.m.xMalloc==0 ){
sqlite3MemSetDefault();
}
@@ -197,7 +198,9 @@ int sqlite3MallocInit(void){
sqlite3GlobalConfig.szPage = 0;
sqlite3GlobalConfig.nPage = 0;
}
return sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);
rc = sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);
if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));
return rc;
}
/*