From 0bf571ea803520d3d097b9dee93d6af9ce2e73b8 Mon Sep 17 00:00:00 2001 From: ice909 Date: Wed, 18 Jun 2025 11:32:43 +0800 Subject: [PATCH] fix: prevent crash in prune command after loop exit Added missing return statements after loop.exit() calls in the prune command to prevent function execution from continuing after exit is called. This fixes a crash that occurred when the function continued executing code after requesting the event loop to exit, potentially accessing invalid memory. --- libs/linglong/src/linglong/cli/cli.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/linglong/src/linglong/cli/cli.cpp b/libs/linglong/src/linglong/cli/cli.cpp index ed6dd5a3f..206b47247 100644 --- a/libs/linglong/src/linglong/cli/cli.cpp +++ b/libs/linglong/src/linglong/cli/cli.cpp @@ -1513,11 +1513,13 @@ int Cli::prune([[maybe_unused]] CLI::App *subcommand) if (!ret) { this->printer.printErr(ret.error()); loop.exit(-1); + return; } if (!ret->packages) { this->printer.printErr(LINGLONG_ERRV("No packages to prune.")); loop.exit(0); + return; } this->printer.printPruneResult(*ret->packages);