mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Fix a couple of memory leaks in the shell tool code that could occur when processing errors.
FossilOrigin-Name: e84f09d469ee76a5b5e44baf6a69b90c69d4160fa4c32de04a96f868643acd96
This commit is contained in:
@ -8955,6 +8955,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
eputf("%s: empty file\n", sCtx.zFile);
|
||||
import_cleanup(&sCtx);
|
||||
rc = 1;
|
||||
sqlite3_free(zCreate);
|
||||
goto meta_command_exit;
|
||||
}
|
||||
zCreate = sqlite3_mprintf("%z%z\n", zCreate, zColDefs);
|
||||
@ -12749,8 +12750,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
if( azCmd[i][0]=='.' ){
|
||||
rc = do_meta_command(azCmd[i], &data);
|
||||
if( rc ){
|
||||
free(azCmd);
|
||||
return rc==2 ? 0 : rc;
|
||||
if( rc==2 ) rc = 0;
|
||||
goto shell_main_exit;
|
||||
}
|
||||
}else{
|
||||
open_db(&data, 0);
|
||||
@ -12763,8 +12764,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
eputf("Error: unable to process SQL: %s\n", azCmd[i]);
|
||||
}
|
||||
sqlite3_free(zErrMsg);
|
||||
free(azCmd);
|
||||
return rc!=0 ? rc : 1;
|
||||
if( rc==0 ) rc = 1;
|
||||
goto shell_main_exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12824,6 +12825,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
expertFinish(&data, 1, 0);
|
||||
}
|
||||
#endif
|
||||
shell_main_exit:
|
||||
free(azCmd);
|
||||
set_table_name(&data, 0);
|
||||
if( data.db ){
|
||||
|
Reference in New Issue
Block a user