mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
clean up
This commit is contained in:
@@ -51,7 +51,11 @@ lwres_contextcreate(lwres_context_t **contextp, void *arg,
|
|||||||
{
|
{
|
||||||
lwres_context_t *context;
|
lwres_context_t *context;
|
||||||
|
|
||||||
if (malloc_function == NULL) {
|
/*
|
||||||
|
* If we were not given anything special to use, use our own
|
||||||
|
* functions. These are just wrappers around malloc() and free().
|
||||||
|
*/
|
||||||
|
if (malloc_function == NULL || free_function == NULL) {
|
||||||
malloc_function = lwres_malloc;
|
malloc_function = lwres_malloc;
|
||||||
free_function = lwres_free;
|
free_function = lwres_free;
|
||||||
}
|
}
|
||||||
@@ -62,8 +66,11 @@ lwres_contextcreate(lwres_context_t **contextp, void *arg,
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
context->free = lwres_free;
|
/*
|
||||||
context->malloc = lwres_malloc;
|
* Set up the context.
|
||||||
|
*/
|
||||||
|
context->malloc = malloc_function;
|
||||||
|
context->free = free_function;
|
||||||
context->arg = arg;
|
context->arg = arg;
|
||||||
|
|
||||||
*contextp = context;
|
*contextp = context;
|
||||||
@@ -111,16 +118,21 @@ lwres_freegetnamebyaddr(lwres_context_t *contextp,
|
|||||||
static void *
|
static void *
|
||||||
lwres_malloc(void *arg, size_t len)
|
lwres_malloc(void *arg, size_t len)
|
||||||
{
|
{
|
||||||
|
void *mem;
|
||||||
|
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
return (malloc(len));
|
mem = malloc(len);
|
||||||
|
if (mem == NULL)
|
||||||
|
return (NULL);
|
||||||
|
memset(mem, 0xe5, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lwres_free(void *arg, size_t len, void *mem)
|
lwres_free(void *arg, size_t len, void *mem)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
(void)len;
|
|
||||||
|
|
||||||
|
memset(mem, 0xa9, len);
|
||||||
free(mem);
|
free(mem);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user