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