[ldns-users] Memory leak in rdata.c

Jelte Jansen jelte.jansen at sidn.nl
Fri Mar 20 10:03:45 UTC 2015


On 03/20/2015 10:39 AM, Calle Dybedahl wrote:
> The function ldns_rdf_free() frees the RDF structure, but not the data
> it points to. This tiny patch makes valgrind complain less.
> 

might be a gap in the documentation there (or a slight violation of
principle of least surprise), but that was intentional; to free both the
rdf structure and its data the function ldns_rdf_deep_free() is provided:


ldns_rdf_deep_free(ldns_rdf *rd)
{
        if (rd) {
                if (rd->_data) {
                        LDNS_FREE(rd->_data);
                }
                LDNS_FREE(rd);
        }
}


Jelte



More information about the ldns-users mailing list