]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix an assert or memory leak that occurs when trying to EXPLAIN a statement
authordrh <drh@noemail.net>
Wed, 5 Oct 2005 11:35:09 +0000 (11:35 +0000)
committerdrh <drh@noemail.net>
Wed, 5 Oct 2005 11:35:09 +0000 (11:35 +0000)
other than a SELECT that outputs results.  Examples of such statements
include PRAGMA integrity_check or INSERT/DELETE/UPDATE with PRAGMA
count_changes=ON. (CVS 2743)

FossilOrigin-Name: 533a85eee2370aafe204ff3eed50eb7fc0149e83

manifest
manifest.uuid
src/vdbeaux.c
test/delete.test
test/insert2.test

index 724f9d2166f2c1cc023c4fe02c376f7a86a1b505..b7c59138506d7c68e24cebf76bd978409562970b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Changes\sto\ssupport\sTEA\son\scygwin.\s(CVS\s2742)
-D 2005-10-05T10:40:15
+C Fix\san\sassert\sor\smemory\sleak\sthat\soccurs\swhen\strying\sto\sEXPLAIN\sa\sstatement\nother\sthan\sa\sSELECT\sthat\soutputs\sresults.\s\sExamples\sof\ssuch\sstatements\ninclude\sPRAGMA\sintegrity_check\sor\sINSERT/DELETE/UPDATE\swith\sPRAGMA\ncount_changes=ON.\s(CVS\s2743)
+D 2005-10-05T11:35:09
 F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -85,7 +85,7 @@ F src/vdbe.c 3f1adcf4535dd35e4244d19d332fb6b515491c0d
 F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13
 F src/vdbeInt.h 7bedbb9553a10e86b53f75d99e197f3f00a732bf
 F src/vdbeapi.c 85bbe1d0243a89655433d60711b4bd71979b59cd
-F src/vdbeaux.c 2b728d82cf2095386a90051b66e7faf1a143f27d
+F src/vdbeaux.c eb1ce3a40d37a1a7e92749e0ef72e3224fa5e55f
 F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
 F src/vdbemem.c ff426ff6e72aa3f0300a56ec8c7f18099be96b43
 F src/where.c 3ed72ca029b3010a76e3a41b7b02ec1bdf849f00
@@ -137,7 +137,7 @@ F test/crash.test 131259005bb5dbe776eba8de99408a493c69c06c
 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
 F test/date.test 30ca15e608a45d868fd419c901795382efe27020
 F test/default.test 252298e42a680146b1dd64f563b95bdf088d94fb
-F test/delete.test 33e1670049364fc3604217a6c2eda042a47115ab
+F test/delete.test e08ffb452f581d58703d0294242c9e2b8d091916
 F test/delete2.test e382b6a97787197eb8b93dd4ccd37797c3725ea3
 F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab
 F test/diskfull.test d828d72adfc9e2d1a194d25996718c1989152cf9
@@ -154,7 +154,7 @@ F test/index.test 51e01a0928b4b61228917ddd8c6c0e2466547f6f
 F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f
 F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
 F test/insert.test b0a89e1568fe9890758f8f2b43b68e840e8f1a1a
-F test/insert2.test 792ad079f59c7e14cf9397712725224e2112c838
+F test/insert2.test 5a20e1ace5fa0800b58d28284212290189b49aed
 F test/insert3.test c67f0240b1c17e71fa2ed8bb6de064928f549f95
 F test/interrupt.test 170f87c2819f0e56c76e0a754949ea103d05009c
 F test/intpkey.test af4fd826c4784ec5c93b444de07adea0254d0d30
@@ -314,7 +314,7 @@ F www/tclsqlite.tcl ddcf912ea48695603c8ed7efb29f0812ef8d1b49
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 115340d4e85f1bbbab657edbb504284343d86e2c
-R f8808c58f7ce989df672bc4fb38af8c4
+P e80fecc986f1fe93e127398b081054766c5383cf
+R 1631acbffa5851a1d52a1c865ed7e829
 U drh
-Z 84a44cff6e170e8e938eb8de4bc1c585
+Z d0b72eae3ce1e3a73f9f18a3c879cfee
index 6d83cd3fafd28bda58a1eb6a3081e2577448ac2a..b6246df2092ac4486366be7c40627fc2a45adf76 100644 (file)
@@ -1 +1 @@
-e80fecc986f1fe93e127398b081054766c5383cf
\ No newline at end of file
+533a85eee2370aafe204ff3eed50eb7fc0149e83
\ No newline at end of file
index cba9c096d6182968b01189bc0ed8ca50205e9483..26f829f07dd036e8d7de6612a4207246d9c4c7ac 100644 (file)
@@ -857,9 +857,10 @@ static void Cleanup(Vdbe *p){
 void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){
   Mem *pColName;
   int n;
-  assert( 0==p->nResColumn );
-  p->nResColumn = nResColumn;
+  releaseMemArray(p->aColName, p->nResColumn*2);
+  sqliteFree(p->aColName);
   n = nResColumn*2;
+  p->nResColumn = nResColumn;
   p->aColName = pColName = (Mem*)sqliteMalloc( sizeof(Mem)*n );
   if( p->aColName==0 ) return;
   while( n-- > 0 ){
index 3ce7e61cf80db003544f78844bd19835fee6c83c..a3c1ebe490fc9f8824c2b5bc727eb0a79392f0b1 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the DELETE FROM statement.
 #
-# $Id: delete.test,v 1.19 2005/05/27 09:41:13 danielk1977 Exp $
+# $Id: delete.test,v 1.20 2005/10/05 11:35:09 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -49,6 +49,9 @@ do_test delete-3.1.3 {
 do_test delete-3.1.4 {
   execsql {CREATE INDEX index1 ON table1(f1)}
   execsql {PRAGMA count_changes=on}
+  ifcapable explain {
+    execsql {EXPLAIN DELETE FROM table1 WHERE f1=3}
+  }
   execsql {DELETE FROM 'table1' WHERE f1=3}
 } {0}
 do_test delete-3.1.5 {
index 52ee20c7db7ebc9a8ee5645497437b16558e63ce..21bd0b7640861e90e1158d22a066a5bd23bce5b3 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this file is testing the INSERT statement that takes is
 # result from a SELECT.
 #
-# $Id: insert2.test,v 1.17 2005/05/29 14:23:13 danielk1977 Exp $
+# $Id: insert2.test,v 1.18 2005/10/05 11:35:09 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -34,6 +34,13 @@ do_test insert2-1.1.1 {
   execsql {
     CREATE TABLE t1(log int, cnt int);
     PRAGMA count_changes=on;
+  }
+  ifcapable explain {
+    execsql {
+      EXPLAIN INSERT INTO t1 SELECT log, count(*) FROM d1 GROUP BY log;
+    }
+  }
+  execsql {
     INSERT INTO t1 SELECT log, count(*) FROM d1 GROUP BY log;
   }
 } {6}
@@ -269,4 +276,3 @@ ifcapable subquery {
 }
 
 finish_test
-