/ Check-in [5a959160]
Login

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

Overview
Comment:Fix an off-by-one error in the scratch memory allocator.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5a9591607a0a5ba4527bf2a90179651053244953
User & Date: drh 2010-09-02 18:13:01
Context
2010-09-02
19:01
Move the test for an (illegal) scalar sub-query that returns more than one column to earlier in SELECT processing in order to avoid an assert() that can happen later on. check-in: a55842cf user: dan tags: trunk
18:13
Fix an off-by-one error in the scratch memory allocator. check-in: 5a959160 user: drh tags: trunk
17:15
Use sqlite3_mutex_notheld() instead of !sqlite3_mutex_held() inside of assert() statements since the former works when mutexing is disabled while the latter does not. check-in: 2211486b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/malloc.c.

   123    123       sqlite3MemSetDefault();
   124    124     }
   125    125     memset(&mem0, 0, sizeof(mem0));
   126    126     if( sqlite3GlobalConfig.bCoreMutex ){
   127    127       mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
   128    128     }
   129    129     if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100
   130         -      && sqlite3GlobalConfig.nScratch>=0 ){
          130  +      && sqlite3GlobalConfig.nScratch>0 ){
   131    131       int i, n, sz;
   132    132       ScratchFreeslot *pSlot;
   133    133       sz = ROUNDDOWN8(sqlite3GlobalConfig.szScratch);
   134    134       sqlite3GlobalConfig.szScratch = sz;
   135    135       pSlot = (ScratchFreeslot*)sqlite3GlobalConfig.pScratch;
   136    136       n = sqlite3GlobalConfig.nScratch;
   137    137       mem0.pScratchFree = pSlot;