From: "Marc-André Lureau" <mlureau@redhat.com>
To: Li Qiang <liq3ea@gmail.com>
Cc: kraxel@redhat.com, marcandre lureau <marcandre.lureau@redhat.com>,
qemu-devel@nongnu.org, liqiang6-s@360.cn
Subject: Re: [Qemu-devel] [PATCH] virtio-gpu: fix memory leak in resource attach backing
Date: Thu, 29 Dec 2016 09:57:25 -0500 (EST) [thread overview]
Message-ID: <1767808401.7524716.1483023445359.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1483003721-65360-1-git-send-email-liq3ea@gmail.com>
Hi
----- Original Message -----
> In the resource attach backing function, everytime it will
> allocate 'res->iov' thus can leading a memory leak. This
> patch avoid this.
>
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---
> hw/display/virtio-gpu.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index 5f32e1a..045f296 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -705,6 +705,11 @@ virtio_gpu_resource_attach_backing(VirtIOGPU *g,
> return;
> }
>
> + if (res->iov) {
> + cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
> + return;
> + }
> +
I think I would rather return an error in the library for this case.
> ret = virtio_gpu_create_mapping_iov(&ab, cmd, &res->addrs, &res->iov);
> if (ret != 0) {
> cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
> --
> 1.8.3.1
>
>
next prev parent reply other threads:[~2016-12-29 14:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-29 9:28 [Qemu-devel] [PATCH] virtio-gpu: fix memory leak in resource attach backing Li Qiang
2016-12-29 14:57 ` Marc-André Lureau [this message]
2016-12-30 6:13 ` Li Qiang
2017-01-03 9:41 ` 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=1767808401.7524716.1483023445359.JavaMail.zimbra@redhat.com \
--to=mlureau@redhat.com \
--cc=kraxel@redhat.com \
--cc=liq3ea@gmail.com \
--cc=liqiang6-s@360.cn \
--cc=marcandre.lureau@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).