From 9fd9d65995e0c1a7ed96fbd025f42b696c40a3d9 Mon Sep 17 00:00:00 2001 From: Bernhard Berg <34011017+Colfenor@users.noreply.github.com> Date: Sat, 26 Sep 2020 15:56:45 +0200 Subject: [PATCH] reset Qshared ptr (#5470) CLI: Fix heapUseAfterFree in db-create command --- src/cli/keepassxc-cli.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cli/keepassxc-cli.cpp b/src/cli/keepassxc-cli.cpp index 5d326f46e..2f8294446 100644 --- a/src/cli/keepassxc-cli.cpp +++ b/src/cli/keepassxc-cli.cpp @@ -247,6 +247,10 @@ int main(int argc, char** argv) arguments.removeFirst(); int exitCode = command->execute(arguments); + if (command->currentDatabase) { + command->currentDatabase.reset(); + } + #if defined(WITH_ASAN) && defined(WITH_LSAN) // do leak check here to prevent massive tail of end-of-process leak errors from third-party libraries __lsan_do_leak_check();