From: Pierrick Bouvier Date: Tue, 21 Feb 2023 15:30:05 +0000 (+0100) Subject: qga/vss-win32: fix warning for clang++-15 X-Git-Tag: v7.2.2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3f531cee66b12041098f7a809c2a7d6ecb6ad7d;p=thirdparty%2Fqemu.git qga/vss-win32: fix warning for clang++-15 Reported when compiling with clang-windows-arm64. ../qga/vss-win32/install.cpp:537:9: error: variable 'hr' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (!(ControlService(service, SERVICE_CONTROL_STOP, NULL))) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../qga/vss-win32/install.cpp:545:12: note: uninitialized use occurs here return hr; ^~ Signed-off-by: Pierrick Bouvier Fixes: 917ebcb170 ("qga-win: Fix QGA VSS Provider service stop failure") Reviewed-by: Konstantin Kostiuk Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Kostiantyn Kostiuk (cherry picked from commit 0fcd574b025fccdf14d5140687cafe2bc30b634f) Signed-off-by: Michael Tokarev --- diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index b57508fbe0b..b8087e5baaa 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -518,7 +518,7 @@ namespace _com_util /* Stop QGA VSS provider service using Winsvc API */ STDAPI StopService(void) { - HRESULT hr; + HRESULT hr = S_OK; SC_HANDLE manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); SC_HANDLE service = NULL;