]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
network: avoid memory leak of dnsmasq capabilities
authorEric Blake <eblake@redhat.com>
Fri, 13 Mar 2015 20:55:58 +0000 (14:55 -0600)
committerEric Blake <eblake@redhat.com>
Sun, 15 Mar 2015 03:01:26 +0000 (21:01 -0600)
commiteea08abec57024b30cba4e6b3af470f118e0687f
treeb72eb61f415db481128f5639f9b440fe3c4bc9b9
parenta9abc08dffba4361e6e52103140f5127edbc4965
network: avoid memory leak of dnsmasq capabilities

Valgrind detected a leak:

==17820== 102 (56 direct, 46 indirect) bytes in 1 blocks are definitely lost in loss record 479 of 646
==17820==    at 0x4A08946: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==17820==    by 0x508521A: virAllocVar (viralloc.c:560)
==17820==    by 0x50D9FCA: virObjectNew (virobject.c:193)
==17820==    by 0x50A4FD9: dnsmasqCapsNewEmpty (virdnsmasq.c:784)
==17820==    by 0x50A514E: dnsmasqCapsNewFromBinary (virdnsmasq.c:830)
==17820==    by 0x1B508287: networkStateInitialize (bridge_driver.c:666)

It looks like commit 172acef introduced the problem, because
networkGetDnsmasqCaps() increments the reference count but an
early exit never does a matching decrement.

* src/network/bridge_driver.c (networkStateCleanup): Plug leak.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/network/bridge_driver.c