Fix heap-use-after-free & error-msg output in keepassxc-cli

* Fixes #5367
This commit is contained in:
Bernhard 2020-09-01 12:29:21 +02:00 committed by Jonathan White
parent 1c27dccabb
commit 9cf93111d6

View File

@ -158,7 +158,7 @@ void enterInteractiveMode(const QStringList& arguments)
auto cmd = Commands::getCommand(args[0]);
if (!cmd) {
err << QObject::tr("Unknown command %1").arg(args[0]) << "\n";
err << QObject::tr("Unknown command %1").arg(args[0]) << endl;
continue;
} else if (cmd->name == "quit" || cmd->name == "exit") {
break;
@ -167,6 +167,7 @@ void enterInteractiveMode(const QStringList& arguments)
cmd->currentDatabase = currentDatabase;
cmd->execute(args);
currentDatabase = cmd->currentDatabase;
cmd->currentDatabase.reset();
}
if (currentDatabase) {