mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-06 15:49:35 +03:00
Fix a memory leak in shell.c. Reported on the mailing list. This has only been informally tested. (CVS 4153)
FossilOrigin-Name: a008905b39e7d4cd5b39db4906eb3b678e3ee8b7
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sa\scomment\stypo\sreported\son\sthe\smailing\slist.\s(CVS\s4152)
|
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-02T19:31:27
|
D 2007-07-03T05:31:16
|
||||||
F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
|
F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
|
||||||
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
|
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
|
||||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||||
@@ -106,7 +106,7 @@ F src/printf.c 9b3048d270e8bb2f8b910b491ac3aadece6cfab2
|
|||||||
F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
|
F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
|
||||||
F src/select.c e363327d0eba8d758ab00055de962a3bb0bc213e
|
F src/select.c e363327d0eba8d758ab00055de962a3bb0bc213e
|
||||||
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
||||||
F src/shell.c 4b0fc3c76a9f23a1c963e01703c0fbbca1b5c34d
|
F src/shell.c e7534cce78398bc1cac4a643e931fc6221c2897e
|
||||||
F src/sqlite.h.in bbcc5481af9f40ce5762c323cf555581a025f3de
|
F src/sqlite.h.in bbcc5481af9f40ce5762c323cf555581a025f3de
|
||||||
F src/sqlite3ext.h 95575e0d175a0271fe2c3232c0d11e8720ed6887
|
F src/sqlite3ext.h 95575e0d175a0271fe2c3232c0d11e8720ed6887
|
||||||
F src/sqliteInt.h 81183ae71162818bf60478e738ff68604128bb06
|
F src/sqliteInt.h 81183ae71162818bf60478e738ff68604128bb06
|
||||||
@@ -517,7 +517,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||||
P dee1a0fd28e8341af6523ab0c5628b671d7d2811
|
P 25e6df9cdd7d0cbb2bdee9ce76806cfd08314212
|
||||||
R 748ebb7d5611da509fc36402c86fe12b
|
R 1119faa3ec9fa2274abccccd3467ef67
|
||||||
U drh
|
U danielk1977
|
||||||
Z 10e512aabfacbf99d78b5a9941c7ad88
|
Z aeb398c67bd2b4b8c263b0b6ba675a9a
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
25e6df9cdd7d0cbb2bdee9ce76806cfd08314212
|
a008905b39e7d4cd5b39db4906eb3b678e3ee8b7
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
** This file contains code to implement the "sqlite" command line
|
** This file contains code to implement the "sqlite" command line
|
||||||
** utility for accessing SQLite databases.
|
** 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 <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -1590,7 +1590,7 @@ static int _is_command_terminator(const char *zLine){
|
|||||||
** Return the number of errors.
|
** Return the number of errors.
|
||||||
*/
|
*/
|
||||||
static int process_input(struct callback_data *p, FILE *in){
|
static int process_input(struct callback_data *p, FILE *in){
|
||||||
char *zLine;
|
char *zLine = 0;
|
||||||
char *zSql = 0;
|
char *zSql = 0;
|
||||||
int nSql = 0;
|
int nSql = 0;
|
||||||
char *zErrMsg;
|
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) ){
|
while( errCnt==0 || !bail_on_error || (in==0 && stdin_is_interactive) ){
|
||||||
fflush(p->out);
|
fflush(p->out);
|
||||||
|
free(zLine);
|
||||||
zLine = one_input_line(zSql, in);
|
zLine = one_input_line(zSql, in);
|
||||||
if( zLine==0 ){
|
if( zLine==0 ){
|
||||||
break; /* We have reached EOF */
|
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( (zSql==0 || zSql[0]==0) && _all_whitespace(zLine) ) continue;
|
||||||
if( zLine && zLine[0]=='.' && nSql==0 ){
|
if( zLine && zLine[0]=='.' && nSql==0 ){
|
||||||
rc = do_meta_command(zLine, p);
|
rc = do_meta_command(zLine, p);
|
||||||
free(zLine);
|
|
||||||
if( rc==2 ){
|
if( rc==2 ){
|
||||||
break;
|
break;
|
||||||
}else if( rc ){
|
}else if( rc ){
|
||||||
@@ -1649,7 +1649,6 @@ static int process_input(struct callback_data *p, FILE *in){
|
|||||||
memcpy(&zSql[nSql], zLine, len+1);
|
memcpy(&zSql[nSql], zLine, len+1);
|
||||||
nSql += len;
|
nSql += len;
|
||||||
}
|
}
|
||||||
free(zLine);
|
|
||||||
if( zSql && _ends_with_semicolon(zSql, nSql) && sqlite3_complete(zSql) ){
|
if( zSql && _ends_with_semicolon(zSql, nSql) && sqlite3_complete(zSql) ){
|
||||||
p->cnt = 0;
|
p->cnt = 0;
|
||||||
open_db(p);
|
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);
|
if( !_all_whitespace(zSql) ) printf("Incomplete SQL: %s\n", zSql);
|
||||||
free(zSql);
|
free(zSql);
|
||||||
}
|
}
|
||||||
|
free(zLine);
|
||||||
return errCnt;
|
return errCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user