]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuSnapshotForEachQcow2: Don't initialize 'nrollback'
authorPeter Krempa <pkrempa@redhat.com>
Mon, 3 Feb 2025 17:23:29 +0000 (18:23 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 5 Feb 2025 18:29:38 +0000 (19:29 +0100)
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>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_snapshot.c

index 7ce018b026c19e87f64e35b014cc4795a90b241a..e5226db94238e685ff8358751dda292301bcd50a 100644 (file)
@@ -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 */