From: drh Date: Sat, 10 Sep 2005 15:35:06 +0000 (+0000) Subject: Avoid a memory leak and/or assertion failure when parsing a table X-Git-Tag: version-3.6.10~3475 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d891967052014d91ab056714390bd39428c44acd;p=thirdparty%2Fsqlite.git Avoid a memory leak and/or assertion failure when parsing a table declaration that contains a duplicate column name. Ticket #1418. (CVS 2684) FossilOrigin-Name: f43427742b1c086f2621c900f4ede1a34a8b44ee --- diff --git a/manifest b/manifest index 6f5ee78d0b..22502d5733 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\sof\sthe\sCROSS\skeyword\sin\sa\sjoin\sprevents\stable\sreordering.\s\sTicket\s#1414.\s(CVS\s2683) -D 2005-09-10T15:28:09 +C Avoid\sa\smemory\sleak\sand/or\sassertion\sfailure\swhen\sparsing\sa\stable\r\ndeclaration\sthat\scontains\sa\sduplicate\scolumn\sname.\r\nTicket\s#1418.\s(CVS\s2684) +D 2005-09-10T15:35:07 F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -34,7 +34,7 @@ F src/attach.c 4b21689700a72ae281fa85dbaff06b2a62bd49ee F src/auth.c 31e2304bef67f44d635655f44234387ea7d21454 F src/btree.c a1ee183067f20eb5ba33ca45ed47acbc7214fe44 F src/btree.h 1ed561263ca0e335bc3e81d761c9d5ff8c22f61e -F src/build.c 86181cbd89e67e99d0f235428d3b9640ccf17101 +F src/build.c db063dc322fb18227833c7c41152aac314ef347c F src/callback.c 9a1162c8f9dae9fad6d548339669aacb5f6cf76b F src/complete.c 4de937dfdd4c79a501772ab2035b26082f337a79 F src/date.c 7444b0900a28da77e57e3337a636873cff0ae940 @@ -208,7 +208,7 @@ F test/sort.test 0c33a8ae1c238377ad197387c3872175f40d3843 F test/subquery.test e6de53332c0301b3cfa34edc3f3cd5fa1e859efd F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2 F test/sync.test d769caaec48456119316775e35e0fdee2fa852d7 -F test/table.test d0e05ede3f6e5a8b79f8661ddcc4618cf7e69f8a +F test/table.test ec0e6c2186bb8f6824f470caa118524dfd8fe057 F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1 F test/tclsqlite.test 2da3e4b3a79b13c1511c9d0cd995e08f8362e782 F test/temptable.test 7927261befdbc7b0a7ffebb85ecc70a74fa7b15b @@ -306,7 +306,7 @@ F www/tclsqlite.tcl 3df553505b6efcad08f91e9b975deb2e6c9bb955 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 0288fa5d25886f6fbef0be782f12285d62bebd68 -R f8eceac70392349128d8b83ed9d12654 +P 415b8b24629aa12756d8285c094b5f85d8a8e532 +R 235cc9d948e051600520eade7dbee36c U drh -Z 461ac5bc1124c76e7cb4172bfe8587a8 +Z be7b5a2752d3ffcf1cf1e2330b39e495 diff --git a/manifest.uuid b/manifest.uuid index 063d7e351f..ae88ac8ec8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -415b8b24629aa12756d8285c094b5f85d8a8e532 \ No newline at end of file +f43427742b1c086f2621c900f4ede1a34a8b44ee \ No newline at end of file diff --git a/src/build.c b/src/build.c index 6d94c494f4..5c837c7ea3 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.347 2005/09/08 14:17:20 drh Exp $ +** $Id: build.c,v 1.348 2005/09/10 15:35:07 drh Exp $ */ #include "sqliteInt.h" #include @@ -940,7 +940,7 @@ void sqlite3AddColumnType(Parse *pParse, Token *pType){ i = p->nCol-1; if( i<0 ) return; pCol = &p->aCol[i]; - assert( pCol->zType==0 ); + sqliteFree(pCol->zType); pCol->zType = sqlite3NameFromToken(pType); pCol->affinity = sqlite3AffinityType(pType); } diff --git a/test/table.test b/test/table.test index 3fe33aeb73..1817105a62 100644 --- a/test/table.test +++ b/test/table.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # -# $Id: table.test,v 1.40 2005/08/13 00:56:28 drh Exp $ +# $Id: table.test,v 1.41 2005/09/10 15:35:07 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -388,6 +388,11 @@ do_test table-9.1 { CREATE TABLE t6(a,b,a); } } {1 {duplicate column name: a}} +do_test table-9.2 { + catchsql { + CREATE TABLE t6(a varchar(100), b blob, a integer); + } +} {1 {duplicate column name: a}} # Check the foreign key syntax. #