/ Check-in [c6fd3b8f]
Login

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

Overview
Comment:Fix a virtual table related assert() that can fail following a malloc failure. (CVS 6064)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c6fd3b8f29927c0fc634f82885f144c78f0105d9
User & Date: danielk1977 2008-12-24 11:25:40
Context
2008-12-26
07:56
Reset the column cache before coding each step of a trigger program. Candidate fix for #3554. (CVS 6065) check-in: a1b1f6cd user: danielk1977 tags: trunk
2008-12-24
11:25
Fix a virtual table related assert() that can fail following a malloc failure. (CVS 6064) check-in: c6fd3b8f user: danielk1977 tags: trunk
09:30
Fix a couple of problems in test file test_journal.c that were causing segfaults when running all.test. (CVS 6063) check-in: 416c9efb user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  This module is responsible for
    14     14   ** generating the code that loops through a table looking for applicable
    15     15   ** rows.  Indices are selected and used to speed the search when doing
    16     16   ** so is applicable.  Because this module is responsible for selecting
    17     17   ** indices, you might also think of this module as the "query optimizer".
    18     18   **
    19         -** $Id: where.c,v 1.343 2008/12/23 23:56:22 drh Exp $
           19  +** $Id: where.c,v 1.344 2008/12/24 11:25:40 danielk1977 Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   
    23     23   /*
    24     24   ** Trace output macros
    25     25   */
    26     26   #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
................................................................................
  2777   2777   */
  2778   2778   static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
  2779   2779     if( pWInfo ){
  2780   2780       int i;
  2781   2781       for(i=0; i<pWInfo->nLevel; i++){
  2782   2782         sqlite3_index_info *pInfo = pWInfo->a[i].pIdxInfo;
  2783   2783         if( pInfo ){
  2784         -        assert( pInfo->needToFreeIdxStr==0 );
         2784  +        assert( pInfo->needToFreeIdxStr==0 || db->mallocFailed );
         2785  +        if( pInfo->needToFreeIdxStr ){
         2786  +          sqlite3_free(pInfo->idxStr);
         2787  +	}
  2785   2788           sqlite3DbFree(db, pInfo);
  2786   2789         }
  2787   2790       }
  2788   2791       whereClauseClear(pWInfo->pWC);
  2789   2792       sqlite3DbFree(db, pWInfo);
  2790   2793     }
  2791   2794   }
................................................................................
  3089   3092            || bestPlan.plan.u.pIdx!=pIdx)
  3090   3093       ){
  3091   3094         sqlite3ErrorMsg(pParse, "cannot use index: %s", pIdx->zName);
  3092   3095         goto whereBeginError;
  3093   3096       }
  3094   3097     }
  3095   3098     WHERETRACE(("*** Optimizer Finished ***\n"));
  3096         -  if( db->mallocFailed ) goto whereBeginError;
         3099  +  if( db->mallocFailed ){
         3100  +    goto whereBeginError;
         3101  +  }
  3097   3102   
  3098   3103     /* If the total query only selects a single row, then the ORDER BY
  3099   3104     ** clause is irrelevant.
  3100   3105     */
  3101   3106     if( (andFlags & WHERE_UNIQUE)!=0 && ppOrderBy ){
  3102   3107       *ppOrderBy = 0;
  3103   3108     }