[Libguestfs] [PATCH 2/4] launch: libvirt: free format string

Pino Toscano ptoscano at redhat.com
Mon Apr 30 11:07:51 UTC 2018


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




More information about the Libguestfs mailing list