From 5558a8a6973a69cf00115cef1802abf0de2e6229 Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Mon, 17 Jan 2005 07:53:44 +0000 Subject: [PATCH] Fix some memory leak problems with corrupt.test and auto-vacuum databases. (CVS 2226) FossilOrigin-Name: 6244252915fa312a6c4d192464023d95aaef4661 --- manifest | 30 +++++++++++++++--------------- manifest.uuid | 2 +- src/btree.c | 11 +++++------ src/build.c | 6 ++++-- src/util.c | 8 ++++---- test/all.test | 10 +--------- test/corrupt.test | 5 ++++- test/memleak.test | 13 +++++++++++-- test/pager.test | 6 +++++- test/pragma.test | 7 ++++++- tool/memleak3.tcl | 4 +++- 11 files changed, 59 insertions(+), 43 deletions(-) diff --git a/manifest b/manifest index 6b101aea87..a03612a2c7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sincomplete,\spreliminary\sdrafts\sof\snew\sdocumentation.\s(CVS\s2225) -D 2005-01-17T03:42:52 +C Fix\ssome\smemory\sleak\sproblems\swith\scorrupt.test\sand\sauto-vacuum\sdatabases.\s(CVS\s2226) +D 2005-01-17T07:53:44 F Makefile.in 78d6d0af3725aef32468ac9923444d7645d21a28 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -29,9 +29,9 @@ F sqlite3.def dbaeb20c153e1d366e8f421b55a573f5dfc00863 F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a F src/attach.c e49d09dad9f5f9fb10b4b0c1be5a70ae4c45e689 F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea -F src/btree.c da5adfeb27e7236e6e3a0a4f42de2caef0e9ad13 +F src/btree.c 97101cce85304edbaedafc5f39ab12e2dc78b076 F src/btree.h 74d19cf40ab49fd69abe9e4e12a6c321ad86c497 -F src/build.c af1296e8a21a406b4f4c4f1e1365e075071219f3 +F src/build.c 07d50fe1b167c77f183aedd59362d55e1f579163 F src/cursor.c f883813759742068890b1f699335872bfa8fdf41 F src/date.c f3d1f5cd1503dabf426a198f3ebef5afbc122a7f F src/delete.c 32277d2834e36c7538c047f14d643751c256c73b @@ -72,7 +72,7 @@ F src/tokenize.c c1d124ec41422c9ec14360ea3a1f98ca4acf7cf1 F src/trigger.c 98f3b07c08ba01b34cff139ef9687883d325ae8e F src/update.c 0979397c41ac29c54fe0cc687a356d8629a633af F src/utf.c 9bece2c7b94d9002ab1bb900a7658c6f826b0f74 -F src/util.c 03ba0b0b83b14a2ddbc0aaac0681c92c8ebb0b0c +F src/util.c 63e8d77659df88b292ac2a9dbd4766419b0ea158 F src/vacuum.c 1a9db113a027461daaf44724c71dd1ebbd064203 F src/vdbe.c c5a711f146415634b72b05212bab9f222b0cce26 F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181 @@ -82,7 +82,7 @@ F src/vdbeaux.c 6c294f7390880a7bb4795c9e0bc605b1a416579a F src/vdbemem.c 62fe89471b656a922e9879be005abf690509ead3 F src/where.c 3a0d08505e298242f6f151f019a05129a4f8704c F tclinstaller.tcl 36478c3bbfc5b93ceac42d94e3c736937b808432 -F test/all.test d9c4775753de7321c0f93aac2c08b417378d509a +F test/all.test 7f0988442ab811dfa41793b5b550f5828ce316f3 F test/alter.test 95c57a4f461fa81293e0dccef7f83889aadb169a F test/attach.test f39069efd4394422798f249df9a31489aa941ee1 F test/attach2.test eeb987770f4dbe68bd29afdbc2e8cff0142e6eb5 @@ -113,7 +113,7 @@ F test/collate4.test 2d6e38e6b871073313f6d4eebfe1435c7173ebfa F test/collate5.test 7999fb3122386bae38acd8ccd61e0b7c5a30e289 F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638 F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87 -F test/corrupt.test 4b289dfd45b5987a4f12bef9693c49e42b6e76ea +F test/corrupt.test 6a0b5215968a6afc76d975a762f912cd16d03e72 F test/corrupt2.test cb1f813df7559de3021e01170af0bba31507a9a5 F test/crash.test fa5d79ece85e8f6677bd81703db5f869a15963aa F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2 @@ -151,7 +151,7 @@ F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 F test/main.test a60a1d234b5f5784097973bd395514ca56003ef1 F test/malloc.test 4f34764cf8cfdfb0aa43face1ba933442a08eb2b F test/memdb.test 532aac7128a3da494cddc4461d76c6e3988f771b -F test/memleak.test f1fa233f8295dd1d955a00d5e5ee857850f27f29 +F test/memleak.test c0af09191af44a7501ec2494fdd079ac538a256c F test/minmax.test e7048476940df0af11d0f2cf687572f557cd0b29 F test/misc1.test 744f60d1025fa978708b96cb222a07a1feb1524a F test/misc2.test bc852f1622d98b610d1f3e2ceb36ed7271256050 @@ -160,11 +160,11 @@ F test/misc4.test 7edc2542eadd98555c2d25c222b88a93124975ae F test/misuse.test 600738a8e611989bc5f544303f5e311c5f228084 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0 F test/null.test 5a945790ef21b24fd602fe2c7a23847b903f8687 -F test/pager.test 5ac7ce028a697283846d7e0c01622d253c8df1ef +F test/pager.test f378832fd97648674feb6b452ae155b005289d41 F test/pager2.test 49c0f57c7da0b060f0486b85fdd074025caa694e F test/pager3.test 647f696a9cf7409df00a1e0047c2eb55585a1b85 F test/pagesize.test 1b826d1608fd86d2303aa895b5586052ad07eba1 -F test/pragma.test c1b4cdb2545131e4adec3250d02544688c6a5c9d +F test/pragma.test 4a7a06bfa87fdbf2b9e5d1ab89c8af39ddae09b3 F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57 F test/progress.test 5ddba78cb6011fba36093973cfb3ac473b8fb96a x F test/quick.test 91e5b8ae6663dc9e3e754b271f0384f0cae706e6 @@ -212,7 +212,7 @@ F tool/lemon.c eb3b2bbefc0d442fa459f4f1924e598e804eca9c F tool/lempar.c 1e61d2b6cb9d8affa264a13336bc0c088498caa4 F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133 F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8 -F tool/memleak3.tcl 336eb50b0849dbf99b1d5462d9c37291b01b2b43 +F tool/memleak3.tcl b8eb053190e95a55dc188896afb972e8108822d6 F tool/mkkeywordhash.c 408dccad57ed50dc67a9a1ee7fd258e0f0a07bd2 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c @@ -269,7 +269,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746 -P 1edfdcbf142b380172a26d094e6e4a3900db8463 -R 96d57a6b3f846e4dbcc0ea017de3a1a3 -U drh -Z d0fe1f7a9cab327ab894a50df6330b34 +P a01159e8cb93199763d191b739da2a43ec88aab3 +R fbe60a34d6230243e3a7636baa8c41f3 +U danielk1977 +Z 7a02515a37f4bed08ff76d7a050b0eb0 diff --git a/manifest.uuid b/manifest.uuid index 4815a3d38a..ebd74602aa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a01159e8cb93199763d191b739da2a43ec88aab3 \ No newline at end of file +6244252915fa312a6c4d192464023d95aaef4661 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 9f3a1cc67a..2f5a00d115 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.240 2005/01/17 02:12:19 danielk1977 Exp $ +** $Id: btree.c,v 1.241 2005/01/17 07:53:44 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -495,15 +495,14 @@ static int ptrmapPut(Btree *pBt, Pgno key, u8 eType, Pgno parent){ if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){ TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent)); rc = sqlite3pager_write(pPtrmap); - if( rc!=0 ){ - return rc; + if( rc==SQLITE_OK ){ + pPtrmap[offset] = eType; + put4byte(&pPtrmap[offset+1], parent); } - pPtrmap[offset] = eType; - put4byte(&pPtrmap[offset+1], parent); } sqlite3pager_unref(pPtrmap); - return SQLITE_OK; + return rc; } /* diff --git a/src/build.c b/src/build.c index 6bfa929492..928926a4b4 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.290 2004/12/14 03:34:34 drh Exp $ +** $Id: build.c,v 1.291 2005/01/17 07:53:44 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -691,7 +691,9 @@ void sqlite3StartTable( ** index or table name in the same database. Issue an error message if ** it does. */ - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) return; + if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ + goto begin_table_error; + } pTable = sqlite3FindTable(db, zName, db->aDb[iDb].zName); if( pTable ){ sqlite3ErrorMsg(pParse, "table %T already exists", pName); diff --git a/src/util.c b/src/util.c index a9884ae6b6..9bde974972 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.126 2005/01/13 02:14:25 danielk1977 Exp $ +** $Id: util.c,v 1.127 2005/01/17 07:53:44 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -27,11 +27,11 @@ void print_stack_trace(){ int i; int n = backtrace(bt, 30); - sqlite3DebugPrintf("STACK: "); + fprintf(stderr, "STACK: "); for(i=0; i