On 07/19/2016 02:54 AM, marcandre.lur...@redhat.com wrote: > From: Marc-André Lureau <marcandre.lur...@redhat.com> > > qdist_init() allocates of entries, make sure we don't leak it.
s/of // > > 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(-) > Reviewed-by: Eric Blake <ebl...@redhat.com> > 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