From: Marc-André Lureau <marcandre.lur...@redhat.com> qdist_init() allocates of entries, make sure we don't leak it.
Spotted thanks to ASAN. Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- util/qdist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.9.0