Initialize *num_vols to 0 at the top of requester_freeze() so all error
paths and zero-volume early exits return a defined value to the caller.
Previously, only the already-frozen path and the success path set
*num_vols; every goto-out error path left it indeterminate.

The sole caller is qga_vss_freeze(), which already sets *nr_volume = 0.

Signed-off-by: Marc-André Lureau <[email protected]>
---
 qga/vss-win32/requester.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index f14c47f9f7a9..d36a90c17d1d 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -306,8 +306,9 @@ void requester_freeze(int *num_vols, void *mountpoints, 
ErrorSet *errset)
     int num_mount_points = 0;
     VSS_BACKUP_TYPE vss_bt = get_vss_backup_type();
 
+    *num_vols = 0;
+
     if (vss_ctx.pVssbc) { /* already frozen */
-        *num_vols = 0;
         qga_debug("finished, already frozen");
         return;
     }

-- 
2.55.0.543.g5ebe2ebe4ea8


Reply via email to