[Libguestfs] [PATCH] launch: libvirt: do not leak the backend string on error

Pino Toscano ptoscano at redhat.com
Tue Jan 20 15:28:41 UTC 2015


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




More information about the Libguestfs mailing list