diff --git a/manifest b/manifest index 33a48f55ae..a2ef377573 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scomment\stypo\sreported\son\sthe\smailing\slist.\s(CVS\s4152) -D 2007-07-02T19:31:27 +C Fix\sa\smemory\sleak\sin\sshell.c.\sReported\son\sthe\smailing\slist.\sThis\shas\sonly\sbeen\sinformally\stested.\s(CVS\s4153) +D 2007-07-03T05:31:16 F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -106,7 +106,7 @@ F src/printf.c 9b3048d270e8bb2f8b910b491ac3aadece6cfab2 F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88 F src/select.c e363327d0eba8d758ab00055de962a3bb0bc213e F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 -F src/shell.c 4b0fc3c76a9f23a1c963e01703c0fbbca1b5c34d +F src/shell.c e7534cce78398bc1cac4a643e931fc6221c2897e F src/sqlite.h.in bbcc5481af9f40ce5762c323cf555581a025f3de F src/sqlite3ext.h 95575e0d175a0271fe2c3232c0d11e8720ed6887 F src/sqliteInt.h 81183ae71162818bf60478e738ff68604128bb06 @@ -517,7 +517,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P dee1a0fd28e8341af6523ab0c5628b671d7d2811 -R 748ebb7d5611da509fc36402c86fe12b -U drh -Z 10e512aabfacbf99d78b5a9941c7ad88 +P 25e6df9cdd7d0cbb2bdee9ce76806cfd08314212 +R 1119faa3ec9fa2274abccccd3467ef67 +U danielk1977 +Z aeb398c67bd2b4b8c263b0b6ba675a9a diff --git a/manifest.uuid b/manifest.uuid index 41c83f83e8..f1ed5ab421 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -25e6df9cdd7d0cbb2bdee9ce76806cfd08314212 \ No newline at end of file +a008905b39e7d4cd5b39db4906eb3b678e3ee8b7 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index d48906b2f4..cb39eb8902 100644 --- a/src/shell.c +++ b/src/shell.c @@ -12,7 +12,7 @@ ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** -** $Id: shell.c,v 1.163 2007/06/20 13:10:01 drh Exp $ +** $Id: shell.c,v 1.164 2007/07/03 05:31:16 danielk1977 Exp $ */ #include #include @@ -1590,7 +1590,7 @@ static int _is_command_terminator(const char *zLine){ ** Return the number of errors. */ static int process_input(struct callback_data *p, FILE *in){ - char *zLine; + char *zLine = 0; char *zSql = 0; int nSql = 0; char *zErrMsg; @@ -1601,6 +1601,7 @@ static int process_input(struct callback_data *p, FILE *in){ while( errCnt==0 || !bail_on_error || (in==0 && stdin_is_interactive) ){ fflush(p->out); + free(zLine); zLine = one_input_line(zSql, in); if( zLine==0 ){ break; /* We have reached EOF */ @@ -1614,7 +1615,6 @@ static int process_input(struct callback_data *p, FILE *in){ if( (zSql==0 || zSql[0]==0) && _all_whitespace(zLine) ) continue; if( zLine && zLine[0]=='.' && nSql==0 ){ rc = do_meta_command(zLine, p); - free(zLine); if( rc==2 ){ break; }else if( rc ){ @@ -1649,7 +1649,6 @@ static int process_input(struct callback_data *p, FILE *in){ memcpy(&zSql[nSql], zLine, len+1); nSql += len; } - free(zLine); if( zSql && _ends_with_semicolon(zSql, nSql) && sqlite3_complete(zSql) ){ p->cnt = 0; open_db(p); @@ -1680,6 +1679,7 @@ static int process_input(struct callback_data *p, FILE *in){ if( !_all_whitespace(zSql) ) printf("Incomplete SQL: %s\n", zSql); free(zSql); } + free(zLine); return errCnt; }