From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH v3 04/11] virtio-gpu: move iov free to virtio_gpu_cleanup_mapping_iov
Date: Fri, 2 Oct 2015 14:31:49 +0200 [thread overview]
Message-ID: <1443789116-27876-5-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1443789116-27876-1-git-send-email-kraxel@redhat.com>
For symmetry reasons: virtio_gpu_create_mapping_iov() allocates it so
virtio_gpu_cleanup_mapping_iov() should free it, otherwise it's easy to
miss a free() needed and leak memory.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
hw/display/virtio-gpu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index a67d927..73bd9b6 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -563,7 +563,6 @@ int virtio_gpu_create_mapping_iov(struct virtio_gpu_resource_attach_backing *ab,
__func__, ab->resource_id, i);
virtio_gpu_cleanup_mapping_iov(*iov, i);
g_free(ents);
- g_free(*iov);
*iov = NULL;
return -1;
}
@@ -580,12 +579,12 @@ void virtio_gpu_cleanup_mapping_iov(struct iovec *iov, uint32_t count)
cpu_physical_memory_unmap(iov[i].iov_base, iov[i].iov_len, 1,
iov[i].iov_len);
}
+ g_free(iov);
}
static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *res)
{
virtio_gpu_cleanup_mapping_iov(res->iov, res->iov_cnt);
- g_free(res->iov);
res->iov = NULL;
res->iov_cnt = 0;
}
--
1.8.3.1
next prev parent reply other threads:[~2015-10-02 12:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 12:31 [Qemu-devel] [PATCH v3 00/11] add virgl rendering support Gerd Hoffmann
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 01/11] shaders: initialize vertexes once Gerd Hoffmann
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 02/11] sdl2: stop flickering Gerd Hoffmann
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 03/11] ui/console: add opengl context and scanout support interfaces Gerd Hoffmann
2015-10-02 12:31 ` Gerd Hoffmann [this message]
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 05/11] virtio-gpu: change licence from GPLv2 to GPLv2+ Gerd Hoffmann
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 06/11] virtio-gpu: update headers for virgl/3d Gerd Hoffmann
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 07/11] virtio-gpu: add 3d mode and virgl rendering support Gerd Hoffmann
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 08/11] virtio-gpu: add cursor update tracepoint Gerd Hoffmann
2015-10-02 14:36 ` Marc-André Lureau
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 09/11] opengl: add egl-context.[ch] helpers Gerd Hoffmann
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 10/11] gtk/opengl: add opengl context and scanout support (egl) Gerd Hoffmann
2015-10-02 12:31 ` [Qemu-devel] [PATCH v3 11/11] gtk/opengl: add opengl context and scanout support (GtkGLArea) Gerd Hoffmann
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=1443789116-27876-5-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=mst@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).