When the result guestfs_disk_format() is not known, free the string
before returning an error.
---
 lib/launch-libvirt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index e4961f201..844023b80 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -197,6 +197,7 @@ get_source_format_or_autodetect (guestfs_h *g, struct drive 
*drv)
       error (g, _("could not auto-detect the format.\n"
                   "If the format is known, pass the format to libguestfs, eg. 
using the\n"
                   "‘--format’ option, or via the optional ‘format’ argument to 
‘add-drive’."));
+      free (format);
       return NULL;
     }
 
-- 
2.14.3

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to