]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a memory leak introduced by (3842) associated with ticket #2296. (CVS 3848)
authordrh <drh@noemail.net>
Mon, 16 Apr 2007 17:07:55 +0000 (17:07 +0000)
committerdrh <drh@noemail.net>
Mon, 16 Apr 2007 17:07:55 +0000 (17:07 +0000)
FossilOrigin-Name: cdc7608b8d590b2ca19be37f94f2cd17423ba8ac

manifest
manifest.uuid
src/select.c
test/all.test
test/insert3.test
test/quick.test

index a3d5bc11ebaa50c1adf3bdcfd6136e1320a326a4..fdafc7aced7a8dd50d06b26b1ce83beedbd4d131 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\stest\scases\sto\smake\ssure\svirtual\stables\scannot\sbe\sused\sin\sshared-cache\smode.\s(CVS\s3847)
-D 2007-04-16T15:49:41
+C Fix\sa\smemory\sleak\sintroduced\sby\s(3842)\sassociated\swith\sticket\s#2296.\s(CVS\s3848)
+D 2007-04-16T17:07:55
 F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -93,7 +93,7 @@ F src/pragma.c 3b992b5b2640d6ae25cef05aa6a42cd1d6c43234
 F src/prepare.c 37207b2b2ccb41d379b01dd62231686bcc48ef1f
 F src/printf.c 0c6f40648770831341ac45ab32423a80b4c87f05
 F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
-F src/select.c f120e927198532ebb53cfccaa742585f49ac9ac7
+F src/select.c b914abca0ba28893e7fb7c7fb97a05e240e2ce8b
 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
 F src/shell.c 3ae4654560e91220a95738a73d135d91d937cda1
 F src/sqlite.h.in e429f66f9245c7f8675db24b230c950b8672ad1c
@@ -135,7 +135,7 @@ F src/vtab.c ff222fb87e1215d9a89a357ec985e8523760346f
 F src/where.c fce0dad6b230eb7ea844e8b8667c074d07e3fdd5
 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
-F test/all.test 6a03095322e93427a3677ce5daaa20f45640d1f0
+F test/all.test a8dca528354b70a52f130e1bb33dedc6848862a1
 F test/alter.test 6a956625399c83392671da690f44257a4ccf058b
 F test/alter2.test 33fb74e0470455ed6903f8d6e63256c7402cebb1
 F test/alter3.test a6eec8f454be9b6ce73d8d7dc711453675a10ce7
@@ -242,7 +242,7 @@ F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
 F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
 F test/insert.test aef273dd1cee84cc92407469e6bd1b3cdcb76908
 F test/insert2.test 5a20e1ace5fa0800b58d28284212290189b49aed
-F test/insert3.test 09a532d5b6f3a788d91be0d4d368462f522685d1
+F test/insert3.test 72ea6056811fd234f80d923f977c196089947381
 F test/insert4.test 1e27f0a3e5670d5f03c1636f699aa44270945bca
 F test/interrupt.test c38b7f7c17914f0cd6a119beed5d03bc3f47f9eb
 F test/intpkey.test af4fd826c4784ec5c93b444de07adea0254d0d30
@@ -294,7 +294,7 @@ F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
 F test/pragma.test fecb7085f58d9fb5172a5c0b63fd3b25c7bfb414
 F test/printf.test 483b9fe75ffae1fb27328bdce5560b452ba83577
 F test/progress.test 8b22b4974b0a95272566385f8cb8c341c7130df8 x
-F test/quick.test c81ee93163f550e7ab420c7881d0dd415bad46f4
+F test/quick.test 8e7ffe36a1c920cdcce5d641646abde2dafd764b
 F test/quote.test 5891f2338980916cf7415484b4ce785294044adb
 F test/reindex.test 38b138abe36bf9a08c791ed44d9f76cd6b97b78b
 F test/rollback.test 673cd8c44c685ad54987fe7f0eeba84efa09685d
@@ -459,7 +459,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 62ef2b1127e76eae0f76ac51f8238446763a3aac
-R 63c8f1a0e9e6f6320bde3c089061cb75
-U danielk1977
-Z 57c5fb7a4703a03718600740eec93793
+P 66e468adfcf0132e558a666b847ce7c1e024d6fd
+R 3b50384c2975fd4abff376a4b850ec92
+U drh
+Z 608cb9d6d6e4358bd5d53def8d3cbd39
index f55aa235effa60c2b1f5b6ef23b7589bb35f90c4..99d143e2809518cc532d9d2a624a9829beb39a26 100644 (file)
@@ -1 +1 @@
-66e468adfcf0132e558a666b847ce7c1e024d6fd
\ No newline at end of file
+cdc7608b8d590b2ca19be37f94f2cd17423ba8ac
\ No newline at end of file
index d748737835acf02114324302c411cdd92950810f..62ba725654f8f80fa8e69d3005b248ac15b57fd0 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle SELECT statements in SQLite.
 **
-** $Id: select.c,v 1.337 2007/04/16 15:06:25 danielk1977 Exp $
+** $Id: select.c,v 1.338 2007/04/16 17:07:55 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -1421,16 +1421,18 @@ static int matchOrderbyToColumn(
     if( iCol<0 && (zLabel = sqlite3NameFromToken(&pE->token))!=0 ){
       for(j=0, pItem=pEList->a; j<pEList->nExpr; j++, pItem++){
         char *zName;
+        int isMatch;
         if( pItem->zName ){
           zName = sqlite3StrDup(pItem->zName);
         }else{
           zName = sqlite3NameFromToken(&pItem->pExpr->token);
         }
-        if( zName && sqlite3StrICmp(zName, zLabel)==0 ){
+        isMatch = zName && sqlite3StrICmp(zName, zLabel)==0;
+        sqliteFree(zName);
+        if( isMatch ){
           iCol = j;
           break;
         }
-        sqliteFree(zName);
       }
       sqliteFree(zLabel);
     }
index 6b93bfccd4f8f4f5c7bac7cd2e41d77be003d753..9cff8c63e5295f042bc264ed152f48a4a7bc388b 100644 (file)
 #***********************************************************************
 # This file runs all tests.
 #
-# $Id: all.test,v 1.39 2007/04/02 14:19:16 danielk1977 Exp $
+# $Id: all.test,v 1.40 2007/04/16 17:07:55 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 rename finish_test really_finish_test
-proc finish_test {} {memleak_check}
+proc finish_test {} {
+  memleak_check
+}
 
 if {[file exists ./sqlite_test_count]} {
   set COUNT [exec cat ./sqlite_test_count]
@@ -90,6 +92,13 @@ for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
       puts "$tail did not close all files: $sqlite_open_file_count"
       incr nErr
       lappend ::failList $tail
+      set sqlite_open_file_count 0
+    }
+    if {$::sqlite3_tsd_count} {
+      puts "Thread-specific data leak: $::sqlite3_tsd_count instances"
+      incr nErr
+      lappend ::failList $tail
+      set ::sqlite3_tsd_count 0
     }
   }
   if {[info exists Leak]} {
index 62af4ddae189262a5e030a1cd0004b385e5ba148..cddecd520a0557cdd410ff32b9760180ddedaed5 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing corner cases of the INSERT statement.
 #
-# $Id: insert3.test,v 1.5 2006/08/25 23:42:53 drh Exp $
+# $Id: insert3.test,v 1.6 2007/04/16 17:07:55 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -140,7 +140,7 @@ do_test insert3-3.4 {
 
 # Tests for the INSERT INTO ... DEFAULT VALUES construct
 #
-do_test insert4-3.5 {
+do_test insert3-3.5 {
   execsql {
     CREATE TABLE t5(
       a INTEGER PRIMARY KEY,
@@ -150,19 +150,19 @@ do_test insert4-3.5 {
     SELECT * FROM t5;
   }
 } {1 xyz}
-do_test insert4-3.6 {
+do_test insert3-3.6 {
   execsql {
     INSERT INTO t5 DEFAULT VALUES;
     SELECT * FROM t5;
   }
 } {1 xyz 2 xyz}
-do_test insert4-3.7 {
+do_test insert3-3.7 {
   execsql {
     CREATE TABLE t6(x,y DEFAULT 4.3, z DEFAULT x'6869');
     INSERT INTO t6 DEFAULT VALUES;
     SELECT * FROM t6;
   }
 } {{} 4.3 hi}
-
+db close
 
 finish_test
index f52b7ff9cfc07ae9c3709039e4b1d031427d7088..55db5cfdc7496ac5b63e68afe089c3b87affcd6f 100644 (file)
@@ -6,7 +6,7 @@
 #***********************************************************************
 # This file runs all tests.
 #
-# $Id: quick.test,v 1.51 2007/03/31 10:00:49 danielk1977 Exp $
+# $Id: quick.test,v 1.52 2007/04/16 17:07:55 drh Exp $
 
 proc lshift {lvar} {
   upvar $lvar l
@@ -85,6 +85,13 @@ foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
     puts "$tail did not close all files: $sqlite_open_file_count"
     incr nErr
     lappend ::failList $tail
+    set sqlite_open_file_count 0
+  }
+  if {$::sqlite3_tsd_count} {
+    puts "Thread-specific data leak: $::sqlite3_tsd_count instances"
+    incr nErr
+    lappend ::failList $tail
+    set ::sqlite3_tsd_count 0
   }
 }
 source $testdir/misuse.test