[ldns-users] ldns memory management

Matthew Keeler mk at npulsetech.com
Wed Jan 16 15:24:54 UTC 2013

I have a question which I have not been able to answer by reading through
the documentation.

There are many methods such as lens_pkt_all, lens_rr_list_pop_rr or
lens_rr_owner etc.. These methods return pointers to ldns structures.

1) Are the pointers to copies of the data?
2) Should the respective _free functions be called on them once finished
and if so will a subsequent call to the function still return data?

In general if I make a call to ldns_pkt_all it returns a list of rrs. I
loop over it and pop the rrs. When I am done processing the rr should I
free it as I don't think it is associated with the list. If I do free them,
what happens if I call ldns_pkt_all again in another part of the code? Is
the actual underlying data still there?

Matt Keeler

The information contained herein is for the exclusive use of the original recipient.  This information is granted for limited distribution within the recipient's organization for planning purposes only.  Further dissemination, whether private or public, is prohibited and may be covered under a non-disclosure agreement.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20130116/6684f786/attachment.htm>

More information about the ldns-users mailing list