/ Check-in [9e6beda2]
Login

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

Overview
Comment:Make sure the datatype and collating sequence of transients tables are not initialized more than once. Otherwise a memory leak results.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9e6beda2c8d879e438ee933e658f860d6eb42a20
User & Date: drh 2015-04-21 17:07:01
Context
2015-04-21
17:17
Alternative fix for the double-initialization of type and collating sequence problem that leaves the estimated table size intact. check-in: 623ddbdb user: drh tags: trunk
17:07
Make sure the datatype and collating sequence of transients tables are not initialized more than once. Otherwise a memory leak results. check-in: 9e6beda2 user: drh tags: trunk
16:38
Ensure that tables names are dequoted exactly once by the trigger logic. check-in: 9d887b92 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

  1696   1696     assert( pTab->nCol==pSelect->pEList->nExpr || db->mallocFailed );
  1697   1697     if( db->mallocFailed ) return;
  1698   1698     memset(&sNC, 0, sizeof(sNC));
  1699   1699     sNC.pSrcList = pSelect->pSrc;
  1700   1700     a = pSelect->pEList->a;
  1701   1701     for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
  1702   1702       p = a[i].pExpr;
         1703  +    if( pCol->zType ) break;
         1704  +    if( pCol->zColl ) break;
  1703   1705       pCol->zType = sqlite3DbStrDup(db, columnType(&sNC, p,0,0,0, &pCol->szEst));
  1704   1706       szAll += pCol->szEst;
  1705   1707       pCol->affinity = sqlite3ExprAffinity(p);
  1706   1708       if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_NONE;
  1707   1709       pColl = sqlite3ExprCollSeq(pParse, p);
  1708   1710       if( pColl ){
  1709   1711         pCol->zColl = sqlite3DbStrDup(db, pColl->zName);

Changes to test/subquery.test.

   579    579   } {30101 30102 30103}
   580    580   do_test subquery-7.11 {
   581    581     execsql {
   582    582       SELECT (SELECT (SELECT max(c7)+max(c8)+max(c9) FROM t9) FROM t8) FROM t7
   583    583     }
   584    584   } {30303}
   585    585   }  ;############# Disabled
          586  +
          587  +# 2015-04-21.
          588  +# Verify that a memory leak in the table column type and collation analysis
          589  +# is plugged.
          590  +#
          591  +do_execsql_test subquery-8.1 {
          592  +  CREATE TABLE t8(a TEXT, b INT);
          593  +  SELECT (SELECT 0 FROM (SELECT * FROM t1)) AS x WHERE x;
          594  +  SELECT (SELECT 0 FROM (SELECT * FROM (SELECT 0))) AS x WHERE x;
          595  +} {}
   586    596   
   587    597   finish_test