From: Florent Bruneau Date: Sat, 11 Oct 2008 19:56:43 +0000 (+0200) Subject: valgrind cleanup (hum, unbound does not cleanup all the memory it allocate...) X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=b661f2f7af5cad8ecf65f77b28e90f50e7bd7a4d;p=apps%2Fpfixtools.git valgrind cleanup (hum, unbound does not cleanup all the memory it allocate...) Signed-off-by: Florent Bruneau --- diff --git a/common/rbl.c b/common/rbl.c index d83d9df..4f8c23f 100644 --- a/common/rbl.c +++ b/common/rbl.c @@ -49,6 +49,7 @@ typedef struct rbl_context_t { ARRAY(rbl_context_t); static struct ub_ctx *ctx = NULL; +static server_t *async_event = NULL; static PA(rbl_context_t) ctx_pool = ARRAY_INIT; static rbl_context_t *rbl_context_new(void) @@ -89,6 +90,11 @@ static void rbl_exit(void) ub_ctx_delete(ctx); ctx = NULL; } + if (async_event != NULL) { + async_event->fd = -1; + server_release(async_event); + async_event = NULL; + } array_deep_wipe(ctx_pool, rbl_context_delete); } module_exit(rbl_exit); @@ -134,7 +140,7 @@ static inline bool rbl_dns_check(const char *hostname, rbl_result_t *result, if (ctx == NULL) { ctx = ub_ctx_create(); ub_ctx_async(ctx, true); - if (server_register(ub_fd(ctx), rbl_handler, NULL) == NULL) { + if ((async_event = server_register(ub_fd(ctx), rbl_handler, NULL)) == NULL) { crit("cannot register asynchronous DNS event handler"); abort(); }