[Libguestfs] [PATCH] launch: libvirt: do not leak the backend string on error
Hu Tao
hutao at cn.fujitsu.com
Wed Jan 21 02:30:32 UTC 2015
Reviewed-by: Hu Tao <hutao at cn.fujitsu.com>
On Tue, Jan 20, 2015 at 04:28:41PM +0100, Pino Toscano wrote:
> Make sure to free the backend string after using it.
> ---
> src/launch-libvirt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
> index 899742f..6f95e98 100644
> --- a/src/launch-libvirt.c
> +++ b/src/launch-libvirt.c
> @@ -719,6 +719,8 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
> * appliance VM.
> */
> if (!seen_qemu && !seen_kvm) {
> + CLEANUP_FREE char *backend = guestfs_get_backend (g);
> +
> error (g,
> _("libvirt hypervisor doesn't support qemu or KVM,\n"
> "so we cannot create the libguestfs appliance.\n"
> @@ -730,7 +732,7 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
> "Or: if you want to have libguestfs run qemu directly, try:\n"
> " export LIBGUESTFS_BACKEND=direct\n"
> "For further help, read the guestfs(3) man page and libguestfs FAQ."),
> - guestfs_get_backend (g));
> + backend);
> return -1;
> }
>
> --
> 1.9.3
>
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs
More information about the Libguestfs
mailing list