Re: [PATCH] virsh: Report error when taking a snapshot with empty --memspec argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]