diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-06-05 14:55:54 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-06-09 13:46:20 +0200 |
commit | 272545cf215f183ecb84c1d0fca3fd38db806977 (patch) | |
tree | fc1cf0280bcd7a45290312a4293cc358746b6faf /block/qcow.c | |
parent | c3971b883a596abc6af45f53d2f43fb2f59ccd3b (diff) | |
download | qemu-272545cf215f183ecb84c1d0fca3fd38db806977.zip qemu-272545cf215f183ecb84c1d0fca3fd38db806977.tar.gz qemu-272545cf215f183ecb84c1d0fca3fd38db806977.tar.bz2 |
block/qcow.c: Fix memory leak in qcow_create()
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 <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow.c')
-rw-r--r-- | block/qcow.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/block/qcow.c b/block/qcow.c index 95ab123..7bd94dc 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -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 |