diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 3d82276ec2..bc11d3f592 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -211,7 +211,9 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) if (!(dom = vshCommandOptDomain(ctl, cmd, NULL))) goto cleanup; - if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0) { + if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0) + goto cleanup; + if (!from) { buffer = vshStrdup(ctl, ""); } else { if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) {