[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 08/37] qdist: fix entries memory leak
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 08/37] qdist: fix entries memory leak |
Date: |
Tue, 19 Jul 2016 14:54:05 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 07/19/2016 02:54 AM, address@hidden wrote:
> From: Marc-André Lureau <address@hidden>
>
> qdist_init() allocates of entries, make sure we don't leak it.
s/of //
>
> Spotted thanks to ASAN.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> util/qdist.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Reviewed-by: Eric Blake <address@hidden>
> diff --git a/util/qdist.c b/util/qdist.c
> index 56f5738..e94cf46 100644
> --- a/util/qdist.c
> +++ b/util/qdist.c
> @@ -188,7 +188,8 @@ void qdist_bin__internal(struct qdist *to, const struct
> qdist *from, size_t n)
> }
> }
> /* they're equally spaced, so copy the dist and bail out */
> - to->entries = g_new(struct qdist_entry, from->n);
> + to->entries = g_realloc_n(to->entries, from->n,
> + sizeof(struct qdist_entry));
> to->n = from->n;
> memcpy(to->entries, from->entries, sizeof(*to->entries) * to->n);
> return;
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 03/37] qga: free the whole blacklist, (continued)
- [Qemu-devel] [PATCH 04/37] qga: free remaining leaking state, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 05/37] tests: fix test-cutils leaks, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 06/37] tests: fix test-vmstate leaks, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 07/37] tests: fix test-iov leaks, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 08/37] qdist: fix entries memory leak, marcandre . lureau, 2016/07/19
- Re: [Qemu-devel] [PATCH 08/37] qdist: fix entries memory leak,
Eric Blake <=
- [Qemu-devel] [PATCH 09/37] tests: fix check-qom-interface leaks, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 10/37] tests: fix check-qom-proplist leaks, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 11/37] tests: fix small leak in test-io-channel-command, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 12/37] tests: fix leak in test-string-input-visitor, marcandre . lureau, 2016/07/19