-C Memory\sleak\sfixes\sfor\stests\sin\sfile\sselect1.test.\s(CVS\s1599)
-D 2004-06-15T13:36:30
+C Assorted\smemory\sleak\sfixes.\s(CVS\s1600)
+D 2004-06-15T16:51:01
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/auth.c 204e1e9c45e64315589bc8b62cba5d9de29b6a3c
F src/btree.c 2852932e900b1b82e105fd651807f199a1d86f12
F src/btree.h 32f96abef464cf8765b23ca669acfe90d191fcc5
-F src/build.c 916a84fa5f8bfd44dbe14c3d7c923dd07ee7373f
+F src/build.c 19fc5d0336a3fef973d62b3a1728078a319e4045
F src/date.c 65b483caeb0e4dd663667d2f927caa058168ebff
F src/delete.c 911221aadb35d610c84fadb32e71c52990827e58
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
-F src/expr.c f9eafe34828ebc9040b4f0f4de2c1e6a0aee296b
+F src/expr.c 7c19fbc4495f8978439c20528cf3e070df068427
F src/func.c 60bf9412807f95d4694863114ae7009d817de45f
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
F src/insert.c 68c7f3ddd6a7f1e5596d6996da1a2861b3789a3a
F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f
-F src/main.c afb1200c096a90836676da2b3e873a2e0192c718
+F src/main.c da573d5b157dbb376349efcb4ff2cbe830f80c80
F src/md5.c d77a389955759c8329bb357e3d71bac3d6eb710b
F src/os.h 1cb5f0293a30288451fe3c0c73815cf208212ed1
F src/os_common.h ba1b7306e16e2091718f2c48db0fe6c1d7a31bb8
F src/pager.c 8e26112df058f73e718938ed07bdbf10ab942c0f
F src/pager.h bc58d32a9dee464f7268fb68652c130a4216e438
F src/parse.y 097438674976355a10cf177bd97326c548820b86
-F src/pragma.c e288bd122d3ca41ec2032475abde1ff5fa3095f4
+F src/pragma.c be8ed53611971f8c93f66cd31129af89e6d58997
F src/printf.c 63b15f1ea9fe3daa066bb7430fd20d4a2d717dc8
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c 7036757825668f28e446fea3fc97775f16667f35
F src/utf.c e16737b3fc4201bf7ce9bd8ced5250596aa31b76
F src/util.c 90375fa253137562d536ccdd40b297f0fd7413fc
F src/vacuum.c f9561c8095407a970af4e6a304b77c4083433d3e
-F src/vdbe.c 6f022fdf6f4e7273d6f6c39907e5ebd36b300e76
+F src/vdbe.c 208705994c0b3b160cb941a5a410838bd5559cf9
F src/vdbe.h 46f74444a213129bc4b5ce40124dd8ed613b0cde
F src/vdbeInt.h 4e636b1b6c18d1d85b085fe0e5a19d45ad85f382
F src/vdbeapi.c ee350b552fc4c1c695b760f914f69e9c5556e829
-F src/vdbeaux.c 475fb88c1dc2dd170c0d218b0c9da3544f82db74
+F src/vdbeaux.c 3476058d13de206cc79cd7015c73e2bb4f37776e
F src/vdbemem.c 1e7df5ed53bc05433c7d3fb28899cf2c82bd16ac
F src/where.c 7fee7aeb9278f27324f228c55ab453b5f183b486
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P e21a181376d4115c7dbe614f3f8a1fbf82d77c75
-R e061ee699c8f945d020155b0ecea44f4
+P 59db58ebd30cd7c79c32f5a725620e740eff661d
+R 8e2d649247d3314adc65f3fdcaa9f1fe
U danielk1977
-Z 708f1b0423b9ce4121dae16049794fd8
+Z 80be8fa32cc9e1b101e22c8e2ab0aff3
-59db58ebd30cd7c79c32f5a725620e740eff661d
\ No newline at end of file
+07b90f3690768e852384fbbde0ba59e69e24d1da
\ No newline at end of file
** ROLLBACK
** PRAGMA
**
-** $Id: build.c,v 1.218 2004/06/12 09:25:12 danielk1977 Exp $
+** $Id: build.c,v 1.219 2004/06/15 16:51:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
pParse->sNameToken = *pName;
zName = sqlite3TableNameFromToken(pName);
+ if( zName==0 ) return;
if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
+ sqliteFree(zName);
return;
}
- if( zName==0 ) return;
if( db->init.iDb==1 ) isTemp = 1;
#ifndef SQLITE_OMIT_AUTHORIZATION
assert( (isTemp & 1)==isTemp );
sqlite3ErrorMsg(pParse, "unable to open a temporary database "
"file for storing temporary tables");
pParse->nErr++;
+ sqliteFree(zName);
return;
}
if( db->flags & !db->autoCommit ){
if( rc!=SQLITE_OK ){
sqlite3ErrorMsg(pParse, "unable to get a write lock on "
"the temporary database file");
+ sqliteFree(zName);
return;
}
}
}
pTable = sqliteMalloc( sizeof(Table) );
if( pTable==0 ){
+ pParse->rc = SQLITE_NOMEM;
+ pParse->nErr++;
sqliteFree(zName);
return;
}
exit_create_index:
if( pIndex ) sqliteFree(pIndex);
sqlite3ExprListDelete(pList);
- /* sqlite3SrcListDelete(pTable); */
+ sqlite3SrcListDelete(pTblName);
sqliteFree(zName);
return;
}
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.141 2004/06/12 09:25:14 danielk1977 Exp $
+** $Id: expr.c,v 1.142 2004/06/15 16:51:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
if( pNew==0 ) return 0;
pNew->nExpr = pNew->nAlloc = p->nExpr;
pNew->a = pItem = sqliteMalloc( p->nExpr*sizeof(p->a[0]) );
- if( pItem==0 ) return 0; /* Leaks memory after a malloc failure */
+ if( pItem==0 ){
+ sqliteFree(pNew);
+ return 0;
+ }
for(i=0; i<p->nExpr; i++, pItem++){
Expr *pNewExpr, *pOldExpr;
pItem->pExpr = pNewExpr = sqlite3ExprDup(pOldExpr = p->a[i].pExpr);
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.221 2004/06/15 13:36:31 danielk1977 Exp $
+** $Id: main.c,v 1.222 2004/06/15 16:51:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
HashElem *i;
int j;
db->want_to_close = 1;
- if( sqlite3SafetyCheck(db) || sqlite3SafetyOn(db) ){
+
+ /* FIX ME: db->magic may be set to SQLITE_MAGIC_CLOSED if the database
+ ** cannot be opened for some reason. So this routine needs to run in
+ ** that case. But maybe there should be an extra magic value for the
+ ** "failed to open" state.
+ */
+ if( db->magic!=SQLITE_MAGIC_CLOSED &&
+ (sqlite3SafetyCheck(db) || sqlite3SafetyOn(db)) ){
/* printf("DID NOT CLOSE\n"); fflush(stdout); */
return;
}
+
db->magic = SQLITE_MAGIC_CLOSED;
for(j=0; j<db->nDb; j++){
struct Db *pDb = &db->aDb[j];
int chars_parsed = sqlite3utf8CharLen(zSql8, zTail8-zSql8);
*pzTail = (u8 *)zSql + sqlite3utf16ByteLen(zSql, chars_parsed);
}
+ sqliteFree(zSql8);
return rc;
}
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.43 2004/06/12 00:42:35 danielk1977 Exp $
+** $Id: pragma.c,v 1.44 2004/06/15 16:51:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
sqlite3Dequote(zRight);
}
if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, 0) ){
- sqliteFree(zLeft);
- sqliteFree(zRight);
- return;
+ goto pragma_out;
}
/*
int addr;
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
if( pRight->z==pLeft->z ){
sqlite3VdbeSetNumCols(v, 1);
};
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
if( pRight->z==pLeft->z ){
int size = db->cache_size;;
int addr;
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
if( pRight->z==pLeft->z ){
sqlite3VdbeSetNumCols(v, 1);
};
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
if( pRight->z==pLeft->z ){
sqlite3VdbeSetNumCols(v, 1);
Table *pTab;
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
pTab = sqlite3FindTable(db, zRight, 0);
if( pTab ){
Table *pTab;
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
pIdx = sqlite3FindIndex(db, zRight, 0);
if( pIdx ){
Table *pTab;
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
pTab = sqlite3FindTable(db, zRight, 0);
if( pTab ){
Table *pTab;
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
pTab = sqlite3FindTable(db, zRight, 0);
if( pTab ){
int i;
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
sqlite3VdbeSetNumCols(v, 3);
sqlite3VdbeSetColName(v, 0, "seq", P3_STATIC);
};
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
if( pRight->z==pLeft->z ){
sqlite3VdbeAddOp(v, OP_Integer, db->temp_store, 0);
{ OP_Callback, 1, 0, 0}};
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
if( pRight->z==pLeft->z ){
sqlite3VdbeSetNumCols(v, 1);
extern void sqlite3ParserTrace(FILE*, char *);
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
if( getBoolean(zRight) ){
sqlite3ParserTrace(stdout, "parser: ");
/* Initialize the VDBE program */
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "integrity_check", P3_STATIC);
sqlite3VdbeAddOp(v, OP_Integer, pTab->tnum, 0);
cnt++;
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
- if( sqlite3CheckIndexCollSeq(pParse, pIdx) ) return;
+ if( sqlite3CheckIndexCollSeq(pParse, pIdx) ) goto pragma_out;
sqlite3VdbeAddOp(v, OP_Integer, pIdx->tnum, 0);
cnt++;
}
if( pRight->z==pLeft->z ){ /* "PRAGMA encoding" */
if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){
pParse->nErr++;
- return;
+ goto pragma_out;
}
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "encoding", P3_STATIC);
#endif
{}
+pragma_out:
sqliteFree(zLeft);
sqliteFree(zRight);
}
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.374 2004/06/15 13:36:37 danielk1977 Exp $
+** $Id: vdbe.c,v 1.375 2004/06/15 16:51:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
pOp->opcode = OP_String;
if( db->enc!=SQLITE_UTF8 && pOp->p3 ){
+ char *z = pOp->p3;
if( db->enc==SQLITE_UTF16LE ){
- pOp->p3 = sqlite3utf8to16le(pOp->p3, -1);
+ pOp->p3 = sqlite3utf8to16le(z, -1);
}else{
- pOp->p3 = sqlite3utf8to16be(pOp->p3, -1);
+ pOp->p3 = sqlite3utf8to16be(z, -1);
}
+ if( pOp->p3type==P3_DYNAMIC ){
+ sqliteFree(z);
+ }
+ pOp->p3type = P3_DYNAMIC;
if( !pOp->p3 ) goto no_mem;
}
pOp->p3 = zBlob;
pOp->p3type = P3_DYNAMIC;
}else{
+ if( pOp->p3type==P3_DYNAMIC ){
+ sqliteFree(pOp->p3);
+ }
pOp->p3type = P3_STATIC;
pOp->p3 = "";
}
ctx.s.flags = MEM_Null;
ctx.s.z = aMem[i].zShort;
ctx.pAgg = (void*)aMem[i].z;
- freeCtx = aMem[i].z && aMem[i].z!=aMem[i].zShort;
ctx.cnt = aMem[i].i;
ctx.isStep = 0;
ctx.pFunc = p->agg.apFunc[i];
(*p->agg.apFunc[i]->xFinalize)(&ctx);
+ aMem[i].z = ctx.pAgg;
+ freeCtx = aMem[i].z && aMem[i].z!=aMem[i].zShort;
if( freeCtx ){
sqliteFree( aMem[i].z );
}
ctx.isStep = 0;
ctx.isError = 0;
(*pAgg->apFunc[i]->xFinalize)(&ctx);
+ pMem->z = ctx.pAgg;
if( pMem->z!=0 && pMem->z!=pMem->z ){
sqliteFree(pMem->z);
}