qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 2/2] vmdk: fix buf leak in vmdk_parse_extents()
Date: Thu,  4 Sep 2014 21:04:43 +0100	[thread overview]
Message-ID: <1409861083-9634-3-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1409861083-9634-1-git-send-email-stefanha@redhat.com>

vmdk_open_sparse() does not take ownership of buf so the caller always
needs to free it.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/vmdk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index 9bf28f3..a1cb911 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -846,8 +846,8 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
             } else {
                 ret = vmdk_open_sparse(bs, extent_file, bs->open_flags, buf, errp);
             }
+            g_free(buf);
             if (ret) {
-                g_free(buf);
                 bdrv_unref(extent_file);
                 return ret;
             }
-- 
1.9.3

  parent reply	other threads:[~2014-09-04 20:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 20:04 [Qemu-devel] [PATCH 0/2] vmdk: fix leaks in vmdk_parse_extents() Stefan Hajnoczi
2014-09-04 20:04 ` [Qemu-devel] [PATCH 1/2] vmdk: fix vmdk_parse_extents() extent_file leaks Stefan Hajnoczi
2014-09-04 20:11   ` Max Reitz
2014-09-05  4:52   ` Fam Zheng
2014-09-04 20:04 ` Stefan Hajnoczi [this message]
2014-09-04 20:13   ` [Qemu-devel] [PATCH 2/2] vmdk: fix buf leak in vmdk_parse_extents() Max Reitz
2014-09-05  4:52   ` Fam Zheng
2014-09-05  9:44 ` [Qemu-devel] [PATCH 0/2] vmdk: fix leaks " Stefan Hajnoczi

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=1409861083-9634-3-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).