From msheldon at godaddy.com Wed Dec 17 17:55:24 2014 From: msheldon at godaddy.com (Michael J. Sheldon) Date: Wed, 17 Dec 2014 17:55:24 +0000 Subject: [ldns-users] Memory leak in ldns_dnssec_zone_sign_nsec3 / ldns_dnssec_zone_deep_free Message-ID: <1418838923760.29396@godaddy.com> 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 GoDaddy.com From msheldon at godaddy.com Thu Dec 18 15:51:39 2014 From: msheldon at godaddy.com (Michael J. Sheldon) Date: Thu, 18 Dec 2014 15:51:39 +0000 Subject: [ldns-users] Memory leak in ldns_dnssec_zone_sign_nsec3 / ldns_dnssec_zone_deep_free In-Reply-To: <1418838923760.29396@godaddy.com> References: <1418838923760.29396@godaddy.com> Message-ID: <1418917898442.70817@godaddy.com> 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) { ldns_traverse_postorder(zone->hashed_names, ldns_dnssec_name_node_free, NULL); LDNS_FREE(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 GoDaddy.com ________________________________________ From: ldns-users on behalf of Michael J. Sheldon 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 GoDaddy.com _______________________________________________ ldns-users mailing list ldns-users at open.nlnetlabs.nl http://open.nlnetlabs.nl/mailman/listinfo/ldns-users