From: Michal Privoznik <mprivozn@redhat.com>
To: qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com
Subject: [PATCH 2/2] vfio-helpers: Free QEMUVFIOState in qemu_vfio_close()
Date: Mon, 11 Nov 2019 11:37:42 +0100 [thread overview]
Message-ID: <14247f68a13c7b9292b91eb7df02de9b9d248544.1573468531.git.mprivozn@redhat.com> (raw)
In-Reply-To: <cover.1573468531.git.mprivozn@redhat.com>
The qemu_vfio_open_pci() allocates this QEMUVFIOState structure
but free counterpart is missing. Since we already have
qemu_vfio_close() which does cleanup of the state, it looks like
a perfect place to free the structure too.
==178278== 528 (360 direct, 168 indirect) bytes in 1 blocks are definitely lost in loss record 6,605 of 6,985
==178278== at 0x4A35476: calloc (vg_replace_malloc.c:752)
==178278== by 0x51B1158: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.6000.6)
==178278== by 0xA68613: qemu_vfio_open_pci (vfio-helpers.c:428)
==178278== by 0x9779EA: nvme_init (nvme.c:606)
==178278== by 0x97830F: nvme_file_open (nvme.c:795)
==178278== by 0x8E9439: bdrv_open_driver (block.c:1293)
==178278== by 0x8E9E1C: bdrv_open_common (block.c:1553)
==178278== by 0x8ED264: bdrv_open_inherit (block.c:3083)
==178278== by 0x8ED79D: bdrv_open (block.c:3176)
==178278== by 0x5DA5C1: bds_tree_init (blockdev.c:670)
==178278== by 0x5E2B64: qmp_blockdev_add (blockdev.c:4354)
==178278== by 0x5ECB1D: configure_blockdev (vl.c:1202)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
util/vfio-helpers.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index 813f7ec564..5ff91c1e5c 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -721,4 +721,5 @@ void qemu_vfio_close(QEMUVFIOState *s)
close(s->device);
close(s->group);
close(s->container);
+ g_free(s);
}
--
2.23.0
next prev parent reply other threads:[~2019-11-11 10:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 10:37 [PATCH 0/2] A pair of memory access problems Michal Privoznik
2019-11-11 10:37 ` [PATCH 1/2] hw/vfio/pci: Fix double free of migration_blocker Michal Privoznik
2019-11-11 10:52 ` Cornelia Huck
2019-11-11 10:37 ` Michal Privoznik [this message]
2019-11-11 11:15 ` [PATCH 2/2] vfio-helpers: Free QEMUVFIOState in qemu_vfio_close() Cornelia Huck
2019-11-12 15:25 ` Michal Privoznik
2019-11-11 14:13 ` [PATCH 0/2] A pair of memory access problems no-reply
2019-11-15 16:31 ` Alex Williamson
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=14247f68a13c7b9292b91eb7df02de9b9d248544.1573468531.git.mprivozn@redhat.com \
--to=mprivozn@redhat.com \
--cc=alex.williamson@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).