From: Ján Tomko Date: Thu, 15 Nov 2012 10:37:32 +0000 (+0100) Subject: virsh: fix uninitialized variable in cmdSnapshotEdit X-Git-Tag: CVE-2012-3411~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=689b64d666bc268d55395a92a2b9d6cd51b3ad70;p=thirdparty%2Flibvirt.git 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. --- diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 4281109dbd..0bd9583a90 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -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);