/ Check-in [38f9ce65]
Login

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

Overview
Comment:Further attempts to reduce the number of false-positives genenerated by static analysis tools.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 38f9ce6503c4dd05ccdd73463b1784a6df7ed6e5018c29c5874a3681ca34ba54
User & Date: drh 2018-08-21 12:46:34
Context
2018-08-21
17:03
Fix a test case that was failing for SQLITE_ENABLE_STAT4 builds. check-in: 1e29fd43 user: dan tags: trunk
12:46
Further attempts to reduce the number of false-positives genenerated by static analysis tools. check-in: 38f9ce65 user: drh tags: trunk
12:16
Fix various harmless warnings generated by static analysis tools. check-in: a04a0ea9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbesort.c.

  2103   2103   static int vdbeMergeEngineInit(
  2104   2104     SortSubtask *pTask,             /* Thread that will run pMerger */
  2105   2105     MergeEngine *pMerger,           /* MergeEngine to initialize */
  2106   2106     int eMode                       /* One of the INCRINIT_XXX constants */
  2107   2107   ){
  2108   2108     int rc = SQLITE_OK;             /* Return code */
  2109   2109     int i;                          /* For looping over PmaReader objects */
  2110         -  int nTree = pMerger->nTree;
         2110  +  int nTree;                      /* Number of subtrees to merge */
         2111  +
         2112  +  /* Failure to allocate the merge would have been detected prior to
         2113  +  ** invoking this routine */
         2114  +  assert( pMerger!=0 );
  2111   2115   
  2112   2116     /* eMode is always INCRINIT_NORMAL in single-threaded mode */
  2113   2117     assert( SQLITE_MAX_WORKER_THREADS>0 || eMode==INCRINIT_NORMAL );
  2114   2118   
  2115   2119     /* Verify that the MergeEngine is assigned to a single thread */
  2116   2120     assert( pMerger->pTask==0 );
  2117   2121     pMerger->pTask = pTask;
  2118   2122   
         2123  +  nTree = pMerger->nTree;
  2119   2124     for(i=0; i<nTree; i++){
  2120   2125       if( SQLITE_MAX_WORKER_THREADS>0 && eMode==INCRINIT_ROOT ){
  2121   2126         /* PmaReaders should be normally initialized in order, as if they are
  2122   2127         ** reading from the same temp file this makes for more linear file IO.
  2123   2128         ** However, in the INCRINIT_ROOT case, if PmaReader aReadr[nTask-1] is
  2124   2129         ** in use it will block the vdbePmaReaderNext() call while it uses
  2125   2130         ** the main thread to fill its buffer. So calling PmaReaderNext()