[libvirt] [PATCH] virsh: Report error when taking a snapshot with empty --memspec argument
Peter Krempa
pkrempa at redhat.com
Thu Nov 22 13:33:30 UTC 2012
On 11/22/12 12:09, Martin Kletzander wrote:
> On 11/22/2012 11:03 AM, Peter Krempa wrote:
>> When the value of memspec was empty taking of a snapshot failed without
>> reporting an error.
>> ---
>> tools/virsh-snapshot.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
>> index 398730c..057ae2d 100644
>> --- a/tools/virsh-snapshot.c
>> +++ b/tools/virsh-snapshot.c
>> @@ -358,7 +358,12 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
>> if (desc)
>> virBufferEscapeString(&buf, " <description>%s</description>\n", desc);
>>
>> - if (vshCommandOptString(cmd, "memspec", &memspec) < 0 ||
>> + if (vshCommandOptString(cmd, "memspec", &memspec) < 0) {
>> + vshError(ctl, _("memspec argument must not be empty"));
>> + goto cleanup;
Hm, we'd leak the contents of "buf" here. I'll post a V2 soon.
Peter
More information about the libvir-list
mailing list