/ Check-in [3e872011]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid leaving the malloc subsystem in a partially initialized state if the low-level initialization callback fails.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3e872011ff5e27738c282f46d2b5803d94fe4b76
User & Date: drh 2015-03-26 17:04:23
Context
2015-03-26
18:24
Revise Win32 locking test to account for recent log message changes. check-in: 1bc76339 user: mistachkin tags: trunk
17:04
Avoid leaving the malloc subsystem in a partially initialized state if the low-level initialization callback fails. check-in: 3e872011 user: drh tags: trunk
15:27
Provide source code line numbers for errors in the Windows VFS generated by the winLogIoerr() routine. check-in: b5da0d93 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/malloc.c.

   158    158     sqlite3_soft_heap_limit64(n);
   159    159   }
   160    160   
   161    161   /*
   162    162   ** Initialize the memory allocation subsystem.
   163    163   */
   164    164   int sqlite3MallocInit(void){
          165  +  int rc;
   165    166     if( sqlite3GlobalConfig.m.xMalloc==0 ){
   166    167       sqlite3MemSetDefault();
   167    168     }
   168    169     memset(&mem0, 0, sizeof(mem0));
   169    170     if( sqlite3GlobalConfig.bCoreMutex ){
   170    171       mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
   171    172     }
................................................................................
   193    194     }
   194    195     if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512
   195    196         || sqlite3GlobalConfig.nPage<1 ){
   196    197       sqlite3GlobalConfig.pPage = 0;
   197    198       sqlite3GlobalConfig.szPage = 0;
   198    199       sqlite3GlobalConfig.nPage = 0;
   199    200     }
   200         -  return sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);
          201  +  rc = sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);
          202  +  if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));
          203  +  return rc;
   201    204   }
   202    205   
   203    206   /*
   204    207   ** Return true if the heap is currently under memory pressure - in other
   205    208   ** words if the amount of heap used is close to the limit set by
   206    209   ** sqlite3_soft_heap_limit().
   207    210   */