From: Osier Yang Date: Mon, 4 Jun 2012 09:08:34 +0000 (+0800) Subject: virsh: Back out if the argument for vol-create-as is malformed X-Git-Tag: v0.9.13-rc1~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee58b581c4b275f06904253285b7ad562dc09745;p=thirdparty%2Flibvirt.git virsh: Back out if the argument for vol-create-as is malformed --- diff --git a/tools/virsh.c b/tools/virsh.c index 260a0be220..abcfbffa38 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -11372,18 +11372,24 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptString(cmd, "capacity", &capacityStr) <= 0) goto cleanup; - if (vshVolSize(capacityStr, &capacity) < 0) + + if (vshVolSize(capacityStr, &capacity) < 0) { vshError(ctl, _("Malformed size %s"), capacityStr); + goto cleanup; + } if (vshCommandOptString(cmd, "allocation", &allocationStr) > 0 && - vshVolSize(allocationStr, &allocation) < 0) + vshVolSize(allocationStr, &allocation) < 0) { vshError(ctl, _("Malformed size %s"), allocationStr); + goto cleanup; + } if (vshCommandOptString(cmd, "format", &format) < 0 || vshCommandOptString(cmd, "backing-vol", &snapshotStrVol) < 0 || vshCommandOptString(cmd, "backing-vol-format", &snapshotStrFormat) < 0) { vshError(ctl, "%s", _("missing argument")); + goto cleanup; }