[ldns-users] Memory leak in ldns_dnssec_zone_sign_nsec3 / ldns_dnssec_zone_deep_free

Michael J. Sheldon msheldon at godaddy.com
Thu Dec 18 15:51:39 UTC 2014

As near as I can tell from my testing, the following should be added to both ldns_zone_free and ldns_zone_deep_free in dnssec_zone.c

if (zone->hashed_names) {

Note that  ldns_dnssec_name_node_deep_free should not be used on this structure, all of its data is referenced from zone->names

Still not sure about the _nsec3params member. I can't find anywhere it's populated when I'm using a ldns_dnssec_zone structure. I suspect it's a reference into names though, so it would not need to be separately free'd.

Michael Sheldon
Dev-DNS Services

From: ldns-users <ldns-users-bounces at open.nlnetlabs.nl> on behalf of Michael J. Sheldon <msheldon at godaddy.com>
Sent: Wednesday, December 17, 2014 10:55
To: ldns-users at open.nlnetlabs.nl
Subject: [ldns-users] Memory leak in ldns_dnssec_zone_sign_nsec3 / ldns_dnssec_zone_deep_free

I'm seeing memory leaks in my app whenever I am signing NSEC3 zones (NSEC zones do not show this behaviour)

168 (24 direct, 144 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3
at 0x4A06A2E: malloc (vg_replace_malloc.c:270)
by 0x31BF8363BA: ldns_rbtree_create (in /usr/lib64/libldns.so.1.6.17)
by 0x31BF81E6EB: ??? (in /usr/lib64/libldns.so.1.6.17)
by 0x31BF81FF53: ldns_dnssec_zone_sign_nsec3_flg_mkmap (in /usr/lib64/libldns.so.1.6.17)
by 0x31BF820113: ldns_dnssec_zone_sign_nsec3 (in /usr/lib64/libldns.so.1.6.17)

One thing I noticed in the code docs, in ldns_dnssec_zone_free and ldns_dnssec_zone_deep_free, the names rbtree is freed, but the hashed_names rbtree is not.

Also, the _nsec3params member is not free'd though this is always NULL in my app, so no issues for me.

Michael Sheldon
Dev-DNS Services
ldns-users mailing list
ldns-users at open.nlnetlabs.nl

More information about the ldns-users mailing list