[Libguestfs] [PATCH nbdkit nbd] nbd: Unsuccessful attempt to fix memory leak.

Eric Blake eblake at redhat.com
Sat Dec 2 17:56:07 UTC 2017


On 12/02/2017 09:27 AM, Richard W.M. Jones wrote:
> Hi Eric,
> 
> There's a memory leak in the nbd client.  The message (below) is not
> very useful because somehow debuginfo is missing in the plugin.

I couldn't quickly figure out why that's missing, either.  Actually,
maybe I can; plugins/nbd/Makefile.am has (via copy-and-paste from other
.c plugins):

nbdkit_nbd_plugin_la_CFLAGS = \
        $(WARNINGS_CFLAGS)

which isn't quite right - the moment you override CFLAGS, you have to
remember to include $(AM_CFLAGS) for the shared library to be built with
the user's CFLAGS.  I'll have to test and provide a patch for that later.

> However it's easily reproducible by doing:
> 
>   make check-valgrind TESTS=test-nbd
> 
> I tried the attached patch to fix what I thought was the bug, but
> sadly the fix doesn't work for me :-(  So I guess something else is
> going on, but it does look as if the transactions list also needs to
> be freed.

Spot on, just the wrong place for trying to free it.  The correct place
is as items are removed from the list in the reader loop; patch sent
separately.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171202/c563b5e5/attachment.sig>


More information about the Libguestfs mailing list