[libvirt] [PATCH] conf: avoid memory leaks while parsing seclabel

Martin Kletzander mkletzan at redhat.com
Wed Jul 23 04:53:34 UTC 2014


On Tue, Jul 22, 2014 at 10:08:21PM -0600, Eric Blake wrote:
>Our seclabel parsing was repeatedly assigning malloc'd data into a
>temporary variable, without first freeing the previous use.  Among
>other leaks flagged by valgrind:
>
>==9312== 8 bytes in 1 blocks are definitely lost in loss record 88 of 821
>==9312==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>==9312==    by 0x8C40369: strdup (strdup.c:42)
>==9312==    by 0x50EA799: virStrdup (virstring.c:676)
>==9312==    by 0x50FAEB9: virXPathString (virxml.c:90)
>==9312==    by 0x50FAF1E: virXPathStringLimit (virxml.c:112)
>==9312==    by 0x510F516: virSecurityLabelDefParseXML (domain_conf.c:4571)
>==9312==    by 0x510FB20: virSecurityLabelDefsParseXML (domain_conf.c:4720)
>
>While it was multiple problems, it looks like commit da78351 was
>to blame for all of them.
>
>* src/conf/domain_conf.c (virSecurityLabelDefParseXML): Plug leaks
>detected by valgrind.
>
>Signed-off-by: Eric Blake <eblake at redhat.com>
>---
> src/conf/domain_conf.c | 5 +++++
> 1 file changed, 5 insertions(+)
>

ACK,

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140723/f1264217/attachment-0001.sig>


More information about the libvir-list mailing list