All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	qemu-block@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] block/qcow.c: Fix memory leak in qcow_create()
Date: Mon, 5 Jun 2017 11:19:14 -0300	[thread overview]
Message-ID: <a4365718-b8b9-4968-fa1f-c8608752dd65@amsat.org> (raw)
In-Reply-To: <1496670954-664-1-git-send-email-peter.maydell@linaro.org>

On 06/05/2017 10:55 AM, Peter Maydell wrote:
> 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: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  block/qcow.c | 1 +
>  1 file changed, 1 insertion(+)
>
> 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
>

  parent reply	other threads:[~2017-06-05 14:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-05 13:55 [Qemu-devel] [PATCH] block/qcow.c: Fix memory leak in qcow_create() Peter Maydell
2017-06-05 14:05 ` Eric Blake
2017-06-05 14:19 ` Philippe Mathieu-Daudé [this message]
2017-06-06 11:13 ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a4365718-b8b9-4968-fa1f-c8608752dd65@amsat.org \
    --to=f4bug@amsat.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.