[PATCH 1/3] qemuSnapshotForEachQcow2: Don't initialize 'nrollback'

Peter Krempa posted 3 patches 7 months, 1 week ago
[PATCH 1/3] qemuSnapshotForEachQcow2: Don't initialize 'nrollback'
Posted by Peter Krempa 7 months, 1 week ago
The variable holds the amount of disks to roll back the snapshot for.
The value must be set before the code jumps to the 'rollback:' label so
the best situation is to not initialize it and let the compiler catch
errors rather than initialize the unsigned variable to -1 and let it
crash.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_snapshot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 7ce018b026..e5226db942 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -290,7 +290,7 @@ qemuSnapshotForEachQcow2(virDomainDef *def,
     size_t i;
     bool skipped = false;
     bool create = STREQ(op, "-c");
-    size_t nrollback = -1;
+    size_t nrollback;
     virErrorPtr orig_err;

     /* pre-checks */
-- 
2.48.1