]> Git Repo - qemu.git/commitdiff
block/qcow.c: Fix memory leak in qcow_create()
authorPeter Maydell <[email protected]>
Mon, 5 Jun 2017 13:55:54 +0000 (14:55 +0100)
committerKevin Wolf <[email protected]>
Fri, 9 Jun 2017 11:46:20 +0000 (13:46 +0200)
Coverity points out that the code path in qcow_create() for
the magic "fat:" backing file name leaks the memory used to
store the filename (CID 1307771). Free the memory before
we overwrite the pointer.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/qcow.c

index 95ab123407f1963a52d425c6d496165b31f21f52..7bd94dcd46b83f11eb12d5b1543dbd70127b0ced 100644 (file)
@@ -852,6 +852,7 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp)
             header_size += backing_filename_len;
         } else {
             /* special backing file for vvfat */
+            g_free(backing_file);
             backing_file = NULL;
         }
         header.cluster_bits = 9; /* 512 byte cluster to avoid copying
This page took 0.028107 seconds and 4 git commands to generate.