Fix a problem where a buffer allocated from a lookaside pool was being released using the system free().

FossilOrigin-Name: 67207a15bd7302ffeb2f342532b57b4852838d83
This commit is contained in:
dan 2009-08-19 09:09:38 +00:00
parent 69188d9a66
commit a898aac951
4 changed files with 18 additions and 13 deletions

View File

@ -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

View File

@ -1 +1 @@
362665e89c21fd603d9f8ad6c0ead590e885af7c
67207a15bd7302ffeb2f342532b57b4852838d83

View 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;
}
}

View 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_... */