When IVssAsync::QueryStatus fails, the error was reported using its
output parameter `hr` rather than its return value `hr2`. Since the
output parameter is not guaranteed to be written on failure, this could
report a stale or uninitialized HRESULT, masking the actual error.

Fixes: b39297aedfab ("qemu-ga: Add Windows VSS provider and requester as DLL")
Signed-off-by: Marc-André Lureau <[email protected]>
---
 qga/vss-win32/requester.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index e3a15f83bf90..b3daa060ac01 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -506,7 +506,7 @@ void requester_freeze(int *num_vols, void *mountpoints, 
ErrorSet *errset)
     for (i = 0; i < VSS_TIMEOUT_FREEZE_MSEC/VSS_TIMEOUT_EVENT_MSEC; i++) {
         HRESULT hr2 = vss_ctx.pAsyncSnapshot->QueryStatus(&hr, NULL);
         if (FAILED(hr2)) {
-            err_set(errset, hr, "failed to do snapshot set");
+            err_set(errset, hr2, "failed to query snapshot set status");
             goto out;
         }
         if (hr != VSS_S_ASYNC_PENDING) {

-- 
2.55.0.543.g5ebe2ebe4ea8


Reply via email to