/ 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 Unified Diffs Ignore Whitespace Patch

Changes to src/where.c.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
....
2777
2778
2779
2780
2781
2782
2783

2784


2785
2786
2787
2788
2789
2790
2791
....
3089
3090
3091
3092
3093
3094
3095
3096


3097
3098
3099
3100
3101
3102
3103
** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements.  This module is responsible for
** generating the code that loops through a table looking for applicable
** rows.  Indices are selected and used to speed the search when doing
** so is applicable.  Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.343 2008/12/23 23:56:22 drh Exp $
*/
#include "sqliteInt.h"

/*
** Trace output macros
*/
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
................................................................................
*/
static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
  if( pWInfo ){
    int i;
    for(i=0; i<pWInfo->nLevel; i++){
      sqlite3_index_info *pInfo = pWInfo->a[i].pIdxInfo;
      if( pInfo ){

        assert( pInfo->needToFreeIdxStr==0 );


        sqlite3DbFree(db, pInfo);
      }
    }
    whereClauseClear(pWInfo->pWC);
    sqlite3DbFree(db, pWInfo);
  }
}
................................................................................
         || bestPlan.plan.u.pIdx!=pIdx)
    ){
      sqlite3ErrorMsg(pParse, "cannot use index: %s", pIdx->zName);
      goto whereBeginError;
    }
  }
  WHERETRACE(("*** Optimizer Finished ***\n"));
  if( db->mallocFailed ) goto whereBeginError;



  /* If the total query only selects a single row, then the ORDER BY
  ** clause is irrelevant.
  */
  if( (andFlags & WHERE_UNIQUE)!=0 && ppOrderBy ){
    *ppOrderBy = 0;
  }







|







 







>
|
>
>







 







|
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
....
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
....
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements.  This module is responsible for
** generating the code that loops through a table looking for applicable
** rows.  Indices are selected and used to speed the search when doing
** so is applicable.  Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.344 2008/12/24 11:25:40 danielk1977 Exp $
*/
#include "sqliteInt.h"

/*
** Trace output macros
*/
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
................................................................................
*/
static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
  if( pWInfo ){
    int i;
    for(i=0; i<pWInfo->nLevel; i++){
      sqlite3_index_info *pInfo = pWInfo->a[i].pIdxInfo;
      if( pInfo ){
        assert( pInfo->needToFreeIdxStr==0 || db->mallocFailed );
        if( pInfo->needToFreeIdxStr ){
          sqlite3_free(pInfo->idxStr);
	}
        sqlite3DbFree(db, pInfo);
      }
    }
    whereClauseClear(pWInfo->pWC);
    sqlite3DbFree(db, pWInfo);
  }
}
................................................................................
         || bestPlan.plan.u.pIdx!=pIdx)
    ){
      sqlite3ErrorMsg(pParse, "cannot use index: %s", pIdx->zName);
      goto whereBeginError;
    }
  }
  WHERETRACE(("*** Optimizer Finished ***\n"));
  if( db->mallocFailed ){
    goto whereBeginError;
  }

  /* If the total query only selects a single row, then the ORDER BY
  ** clause is irrelevant.
  */
  if( (andFlags & WHERE_UNIQUE)!=0 && ppOrderBy ){
    *ppOrderBy = 0;
  }