qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>, qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PULL 6/6] virtio-gpu: add live migration support
Date: Tue, 14 Jun 2016 15:26:52 +0200	[thread overview]
Message-ID: <095814af-a30f-ee90-56bc-9b824c2317ac@redhat.com> (raw)
In-Reply-To: <1465196782-28073-7-git-send-email-kraxel@redhat.com>



On 06/06/2016 09:06, Gerd Hoffmann wrote:
> +    while (resource_id != 0) {
> +        res = g_new0(struct virtio_gpu_simple_resource, 1);
> +        res->resource_id = resource_id;
> +        res->width = qemu_get_be32(f);
> +        res->height = qemu_get_be32(f);
> +        res->format = qemu_get_be32(f);
> +        res->iov_cnt = qemu_get_be32(f);
> +
> +        /* allocate */
> +        pformat = get_pixman_format(res->format);
> +        if (!pformat) {
> +            return -EINVAL;

Coverity says, all the "return" statements in this loop leak res.

Paolo

> +        }
> +        res->image = pixman_image_create_bits(pformat,
> +                                              res->width, res->height,
> +                                              NULL, 0);
> +        if (!res->image) {
> +            return -EINVAL;
> +        }
> +
> +        res->addrs = g_new(uint64_t, res->iov_cnt);
> +        res->iov = g_new(struct iovec, res->iov_cnt);
> +
> +        /* read data */
> +        for (i = 0; i < res->iov_cnt; i++) {
> +            res->addrs[i] = qemu_get_be64(f);
> +            res->iov[i].iov_len = qemu_get_be32(f);
> +        }
> +        qemu_get_buffer(f, (void *)pixman_image_get_data(res->image),
> +                        pixman_image_get_stride(res->image) * res->height);
> +
> +        /* restore mapping */
> +        for (i = 0; i < res->iov_cnt; i++) {
> +            hwaddr len = res->iov[i].iov_len;
> +            res->iov[i].iov_base =
> +                cpu_physical_memory_map(res->addrs[i], &len, 1);
> +            if (!res->iov[i].iov_base || len != res->iov[i].iov_len) {
> +                return -EINVAL;
> +            }
> +        }
> +
> +        QTAILQ_INSERT_HEAD(&g->reslist, res, next);
> +
> +        resource_id = qemu_get_be32(f);

  reply	other threads:[~2016-06-14 13:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06  7:06 [Qemu-devel] [PULL v2 0/6] vga patch queue Gerd Hoffmann
2016-06-06  7:06 ` [Qemu-devel] [PULL 1/6] virtio-gpu: fix scanout rectangles Gerd Hoffmann
2016-06-06  7:06 ` [Qemu-devel] [PULL 2/6] vmsvga: move fifo sanity checks to vmsvga_fifo_length Gerd Hoffmann
2016-06-06  7:06 ` [Qemu-devel] [PULL 3/6] vmsvga: add more fifo checks Gerd Hoffmann
2016-06-06  7:06 ` [Qemu-devel] [PULL 4/6] vmsvga: shadow fifo registers Gerd Hoffmann
2016-06-06  7:06 ` [Qemu-devel] [PULL 5/6] vmsvga: don't process more than 1024 fifo commands at once Gerd Hoffmann
2016-06-06  7:06 ` [Qemu-devel] [PULL 6/6] virtio-gpu: add live migration support Gerd Hoffmann
2016-06-14 13:26   ` Paolo Bonzini [this message]
2016-06-06 14:17 ` [Qemu-devel] [PULL v2 0/6] vga patch queue Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2016-06-03  7:34 [Qemu-devel] [PULL " Gerd Hoffmann
2016-06-03  7:34 ` [Qemu-devel] [PULL 6/6] virtio-gpu: add live migration support 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=095814af-a30f-ee90-56bc-9b824c2317ac@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=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).