libvirt/tools
Alex Jia 03ca3317a6 virsh: plug memory leaks on failure path
Leaks are introduced in commit 1cf0e3d and fe383bb.

Fixing memory leaks, in addition, the patch also fixes a potential missing
return value issue in 'if (from)' statement, without the fixing, although
the programming met a error, the subsequent codes will be executed
continually.

* tools/virsh.c (cmdSnapshotList): fix memory leaks and missing return value.

* How to reproduce?

% virsh snapshot-list <domain> --parent --roots
% virsh snapshot-list <domain> --parent --tree
% virsh snapshot-list <domain> --roots --tree

actual result:
error: --parent and --roots are mutually exclusive
error: Failed to disconnect from the hypervisor, 1 leaked reference(s)

error: --parent and --tree are mutually exclusive
error: Failed to disconnect from the hypervisor, 1 leaked reference(s)

error: --roots and --tree are mutually exclusive
error: Failed to disconnect from the hypervisor, 1 leaked reference(s)

% virsh snapshot-create-as <domain> --name "hello"
% virsh snapshot-create-as <domain> --name "libvirt"
% virsh snapshot-list <domain> --roots --from "hello"

actual result:
error: --roots and --from are mutually exclusive
 Name                 Creation Time             State
------------------------------------------------------------
 libvirt              2012-03-28 13:46:51 +0800 running

Signed-off-by: Alex Jia <ajia@redhat.com>
2012-03-28 23:05:08 +08:00
..
console.c virsh: add support for VIR_DOMAIN_CONSOLE_* flags 2012-02-27 15:05:17 +01:00
console.h virsh: add support for VIR_DOMAIN_CONSOLE_* flags 2012-02-27 15:05:17 +01:00
libvirt_win_icon_16x16.ico Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
libvirt_win_icon_32x32.ico Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
libvirt_win_icon_48x48.ico Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
libvirt_win_icon_64x64.ico Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
libvirt-guests.init.sh libvirt-guests: Add parallel startup and shutdown of guests 2012-03-05 13:18:24 +01:00
libvirt-guests.service.in Add support for systemd init service 2011-11-18 16:16:02 +00:00
libvirt-guests.sysconf libvirt-guests: Add parallel startup and shutdown of guests 2012-03-05 13:18:24 +01:00
Makefile.am build: clean up CPPFLAGS/INCLUDES usage 2012-02-03 10:36:02 -07:00
virsh_win_icon.rc Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
virsh.c virsh: plug memory leaks on failure path 2012-03-28 23:05:08 +08:00
virsh.pod snapshot: fix virsh docs 2012-03-27 22:03:20 -06:00
virt-host-validate-common.c Add a virt-host-validate command to sanity check HV config 2012-01-27 17:53:18 +00:00
virt-host-validate-common.h Add a virt-host-validate command to sanity check HV config 2012-01-27 17:53:18 +00:00
virt-host-validate-lxc.c Add a virt-host-validate command to sanity check HV config 2012-01-27 17:53:18 +00:00
virt-host-validate-lxc.h Add a virt-host-validate command to sanity check HV config 2012-01-27 17:53:18 +00:00
virt-host-validate-qemu.c Add a virt-host-validate command to sanity check HV config 2012-01-27 17:53:18 +00:00
virt-host-validate-qemu.h Add a virt-host-validate command to sanity check HV config 2012-01-27 17:53:18 +00:00
virt-host-validate.c build: fix missing include 2012-01-27 11:18:35 -07:00
virt-pki-validate.in virt-*-validate.in: quote all variable references 2011-02-21 10:32:34 -07:00
virt-sanlock-cleanup.in Fix virt-sanlock-cleanup documentation 2011-10-17 10:57:36 -06:00
virt-xml-validate.in virt-*-validate.in: quote all variable references 2011-02-21 10:32:34 -07:00