question regarding memory handling in liblwres
Matthias Wimmer
m at tthias.eu
Wed May 31 00:37:19 UTC 2006
Hi list,
I hope that my question is welcome on this list. At least I could not
find a more adequate list for my question.
I try to use liblwres to do asynchronous DNS queries for SRV records. By
reading the source, I found out, that I can do this using basically the
following call flow/have to use the following functions:
/* at program startup */
lwres_context_create();
while (program_running) {
/* for each request */
lwres_grbnrequest_render()
/* response arrived */
lwres_lwpacket_parseheader();
lwres_grbnresponse_parse();
/* using the result */
/* ..... */
/* freeing the result */
lwres_grbnresponse_free();
}
/* at program shutdown */
lwres_context_destroy();
The problem with this is, that not all memory, that gets allocated, gets
freed as well. lwres_grbnrequest_render() allocates memory for the
result buffer (last_function_argument->base). How is it intended to get
this memory freed? I would consider it an implementation detail, that
liblwres uses malloc()/free() as long as the caller does not provider
other functions. Therefore I cannot just use free() to free the
allocated memory. But I also I cannot use lwres_free() nor ctx->free()
as I do not have access to these functions (they are internals to the
implementation of liblwres as well).
So what is the suggested way to free this memory again?
Thank you for your help in advance
Matthias Wimmer
More information about the bind-users
mailing list