qemuSnapshotForEachQcow2: Don't initialize 'nrollback'

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>
This commit is contained in:
Peter Krempa 2025-02-03 18:23:29 +01:00
parent 15cd4ec832
commit d15eff6304

View 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 */