From 9f76fcf5f17f7db5340ce380340b764d0001d6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 9 May 2020 14:45:47 +0200 Subject: [PATCH] Fixed Cppcheck warning --- cli/cppcheckexecutor.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index aaf85170c..95171b135 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -215,15 +215,23 @@ int CppCheckExecutor::check(int argc, const char* const argv[]) mSettings = &settings; if (!parseFromArgs(&cppCheck, argc, argv)) { + mSettings = nullptr; return EXIT_FAILURE; } if (Settings::terminated()) { + mSettings = nullptr; return EXIT_SUCCESS; } - if (cppCheck.settings().exceptionHandling) { - return check_wrapper(cppCheck, argc, argv); - } - return check_internal(cppCheck, argc, argv); + + int ret; + + if (cppCheck.settings().exceptionHandling) + ret = check_wrapper(cppCheck, argc, argv); + else + ret = check_internal(cppCheck, argc, argv); + + mSettings = nullptr; + return ret; } void CppCheckExecutor::setSettings(const Settings &settings)