[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 10/25] qdist: fix memory leak during binning
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PULL 10/25] qdist: fix memory leak during binning |
Date: |
Tue, 02 Aug 2016 21:13:00 +0000 |
Hi
On Tue, Aug 2, 2016 at 11:53 PM Paolo Bonzini <address@hidden> wrote:
> From: "Emilio G. Cota" <address@hidden>
>
> In qdist_bin__internal(), to->entries is initialized to a 1-element array,
> which we then leak when n == from->n. Fix it.
>
> Signed-off-by: Emilio G. Cota <address@hidden>
> Message-Id: <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> util/qdist.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/util/qdist.c b/util/qdist.c
> index 56f5738..eb2236c 100644
> --- a/util/qdist.c
> +++ b/util/qdist.c
> @@ -188,7 +188,7 @@ 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, n, sizeof(*to->entries));
>
I sent that patch earlier in the leak series, if it's still time, please:
Signed-off-by: Marc-André Lureau <address@hidden>
> to->n = from->n;
> memcpy(to->entries, from->entries, sizeof(*to->entries) * to->n);
> return;
> --
> 2.7.4
>
>
>
>
- [Qemu-devel] [PULL 00/25] Misc QEMU fixes for 2016-08-02, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 01/25] util/qht: Document memory ordering assumptions, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 02/25] numa: set the memory backend "is_mapped" field, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 03/25] fix qemu exit on memory hotplug when allocation fails at prealloc time, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 04/25] checkpatch: add check for bzero, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 06/25] util: drop unix_nonblocking_connect(), Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 05/25] util: drop inet_nonblocking_connect(), Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 08/25] qht: do not segfault when gathering stats from an uninitialized qht, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 09/25] target-i386: fix typo in xsetbv implementation, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 10/25] qdist: fix memory leak during binning, Paolo Bonzini, 2016/08/02
- Re: [Qemu-devel] [PULL 10/25] qdist: fix memory leak during binning,
Marc-André Lureau <=
- [Qemu-devel] [PULL 07/25] util: Drop inet_listen(), Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 11/25] qdist: use g_realloc_n instead of g_realloc, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 12/25] qdist: return "(empty)" instead of NULL when printing an empty dist, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 13/25] mptsas: really fix migration compatibility, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 14/25] i2c: fix migration regression introduced by broadcast support, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 15/25] nbd: Fix bad flag detection on server, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 19/25] fw_cfg: Make base type "fw_cfg" abstract, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 18/25] block: Cater to iscsi with non-power-of-2 discard, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 17/25] osdep: Document differences in rounding macros, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 16/25] nbd: Limit nbdflags to 16 bits, Paolo Bonzini, 2016/08/02