1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

virsh: fix uninitialized variable in cmdSnapshotEdit

If the domain can't be looked up, name is used unitialized after the
cleanup label.

Found by coverity.
This commit is contained in:
Ján Tomko 2012-11-15 11:37:32 +01:00 committed by Michal Privoznik
parent 0c996c10e4
commit 689b64d666

View File

@ -459,7 +459,7 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom = NULL;
virDomainSnapshotPtr snapshot = NULL;
virDomainSnapshotPtr edited = NULL;
const char *name;
const char *name = NULL;
const char *edited_name;
bool ret = false;
unsigned int getxml_flags = VIR_DOMAIN_XML_SECURE;
@ -532,7 +532,7 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
ret = true;
cleanup:
if (!ret)
if (!ret && name)
vshError(ctl, _("Failed to update %s"), name);
if (edited)
virDomainSnapshotFree(edited);