]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: fix uninitialized variable in cmdSnapshotEdit
authorJán Tomko <jtomko@redhat.com>
Thu, 15 Nov 2012 10:37:32 +0000 (11:37 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 15 Nov 2012 10:45:40 +0000 (11:45 +0100)
If the domain can't be looked up, name is used unitialized after the
cleanup label.

Found by coverity.

tools/virsh-snapshot.c

index 4281109dbda766ed6e65821254139faae0f5c375..0bd9583a90f0df9b09c4fe78ec005a293ae342e1 100644 (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);