]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a problem where a buffer allocated from a lookaside pool was being released using...
authordan <dan@noemail.net>
Wed, 19 Aug 2009 09:09:38 +0000 (09:09 +0000)
committerdan <dan@noemail.net>
Wed, 19 Aug 2009 09:09:38 +0000 (09:09 +0000)
FossilOrigin-Name: 67207a15bd7302ffeb2f342532b57b4852838d83

manifest
manifest.uuid
src/analyze.c
src/sqliteInt.h

index d81a2f723ef06e5951ae1882d0c9932289fa3e39..805197d53f72064e2ea3c19ba874a875212137e4 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\sSQLITE_ENABLE_STAT2\smacro.\sIf\sthis\sis\snot\sdefined\sat\sbuild-time,\sthe\sstat2\stable\sis\snot\screated,\spopulated,\sor\sused.
-D 2009-08-19T08:18:32
+C Fix\sa\sproblem\swhere\sa\sbuffer\sallocated\sfrom\sa\slookaside\spool\swas\sbeing\sreleased\susing\sthe\ssystem\sfree().
+D 2009-08-19T09:09:38
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 0f7761c5d1c62ae7a841e3393ffaff1fa0f5c00a
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -100,7 +100,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
 F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
 F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad
 F src/alter.c 8b42cace4f8e312de596807ba2685179da64fec4
-F src/analyze.c 1a5bf2adeb31f603a34e769a49937100a6da240a
+F src/analyze.c 3213d61ee5fbcf8a54ccfc6c07667c595316c559
 F src/attach.c 13995348fc5a26cdd136a50806faf292aabc173f
 F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
 F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
@@ -163,7 +163,7 @@ F src/select.c 67b0778c9585905c8aa75aaa469e76ef3c1d315a
 F src/shell.c db2643650b9268df89a4bedca3f1c6d9e786f1bb
 F src/sqlite.h.in a6850e9034df1336e8139c4d6964d7d2f0f52337
 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
-F src/sqliteInt.h d1a1a37db2d1f597c69ad5884e3e9463a1bd0827
+F src/sqliteInt.h 4422daf1c74034094eee966cbce357232767b308
 F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
 F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d
@@ -744,7 +744,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P ded9dec6459baf21e01f63250db5ace57f390e7a
-R 183c0e0c3d4fd9f579a812122a3f1cb5
+P 362665e89c21fd603d9f8ad6c0ead590e885af7c
+R 0f4157c0cca678abe78a1dd4148f5f03
 U dan
-Z 9353561137495233ae51d7a49e9232d2
+Z 51de1621e1a30aec3aaa94297a00c42c
index e76c8e22beddfc109c8f90b616b3e21737f938cb..cb60c31367a6933d5dd4f668a897a474a41f0050 100644 (file)
@@ -1 +1 @@
-362665e89c21fd603d9f8ad6c0ead590e885af7c
\ No newline at end of file
+67207a15bd7302ffeb2f342532b57b4852838d83
\ No newline at end of file
index 2e00b54ab707ceffd2e08d4d701b11c7b8ffe29c..42645b76436ec49fd65143971396f8ca0e2c9bf6 100644 (file)
@@ -549,13 +549,16 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
         Index *pIdx = sqlite3FindIndex(db, zIndex, sInfo.zDatabase);
         if( pIdx ){
           int iSample = sqlite3_column_int(pStmt, 1);
+          sqlite3 *dbMem = pIdx->pTable->dbMem;
+         assert( dbMem==db || dbMem==0 );
           if( iSample<SQLITE_INDEX_SAMPLES && iSample>=0 ){
             int eType = sqlite3_column_type(pStmt, 2);
 
             if( pIdx->aSample==0 ){
-              static const int nByte = sizeof(IndexSample)*SQLITE_INDEX_SAMPLES;
-              pIdx->aSample = (IndexSample *)sqlite3DbMallocZero(db, nByte);
+              static const int sz = sizeof(IndexSample)*SQLITE_INDEX_SAMPLES;
+              pIdx->aSample = (IndexSample *)sqlite3DbMallocZero(dbMem, sz);
               if( pIdx->aSample==0 ){
+               db->mallocFailed = 1;
                 break;
               }
             }
@@ -563,7 +566,7 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
             if( pIdx->aSample ){
               IndexSample *pSample = &pIdx->aSample[iSample];
               if( pSample->eType==SQLITE_TEXT || pSample->eType==SQLITE_BLOB ){
-                sqlite3DbFree(db, pSample->u.z);
+                sqlite3DbFree(dbMem, pSample->u.z);
               }
               pSample->eType = eType;
               if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
@@ -579,10 +582,11 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
                   n = 24;
                 }
                 pSample->nByte = n;
-                pSample->u.z = sqlite3DbMallocRaw(db, n);
+                pSample->u.z = sqlite3DbMallocRaw(dbMem, n);
                 if( pSample->u.z ){
                   memcpy(pSample->u.z, z, n);
                 }else{
+                 db->mallocFailed = 1;
                   break;
                 }
               }
index 5fc38a5f2a9310f7c3f3ae600fdcd100b7343e21..277ffb4529654bb901c5883dd92f4d05af70f4b9 100644 (file)
@@ -1578,7 +1578,8 @@ struct Expr {
 
   int iTable;            /* TK_COLUMN: cursor number of table holding column
                          ** TK_REGISTER: register number */
-  i16 iColumn;           /* TK_COLUMN: column index.  -1 for rowid */
+  i16 iColumn;           /* TK_COLUMN: column index.  -1 for rowid
+                         ** TK_REGISTER: original value of Expr.op */
   i16 iAgg;              /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
   i16 iRightJoinTable;   /* If EP_FromJoin, the right table of the join */
   u16 flags2;            /* Second set of flags.  EP2_... */