Commit 4cf3d9fbb5 for qemu.org
commit 4cf3d9fbb5891d7618a8cda6caa704bd1d46bdc3
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Mon Sep 7 14:50:03 2026 +0400
qga/vss-win32: free bstrWriterName in outer writer loop
bstrWriterName is obtained from GetIdentity in the outer writer loop,
but freed inside the inner component loop. When a writer has multiple
components, the second and subsequent iterations operate with a NULL
bstrWriterName. If an error occurs in those iterations, the error
message passes NULL
Move SysFreeString(bstrWriterName) to the end of the outer loop where
it belongs.
Fixes: b39297aedfab ("qemu-ga: Add Windows VSS provider and requester as DLL")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260907-qga-v1-5-86456ad356e2@redhat.com
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 52176d7512..b9269acb5b 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -230,11 +230,11 @@ static void AddComponents(ErrorSet *errset)
goto out;
}
}
- SysFreeString(bstrWriterName);
- bstrWriterName = NULL;
pComponent->FreeComponentInfo(info);
info = NULL;
}
+ SysFreeString(bstrWriterName);
+ bstrWriterName = NULL;
}
out:
if (bstrWriterName) {