summaryrefslogtreecommitdiffstats
path: root/daemon/network.c
diff options
context:
space:
mode:
authorMarek Vavrusa <marek@vavrusa.com>2016-05-27 07:52:39 +0200
committerMarek Vavrusa <marek@vavrusa.com>2016-05-27 07:52:39 +0200
commitaddf898ec1263ca16540e13d92a6a4e18cb3d5e1 (patch)
tree2c90c6297f4f542cfb1ba4a619c4a68694e71cef /daemon/network.c
parentbuild: unbroken Go build checks (diff)
downloadknot-resolver-addf898ec1263ca16540e13d92a6a4e18cb3d5e1.tar.xz
knot-resolver-addf898ec1263ca16540e13d92a6a4e18cb3d5e1.zip
daemon: fixed socket mempool cleanup on exit
fixes #73 small leak in cleaning up per-socket mempool on daemon exit
Diffstat (limited to 'daemon/network.c')
-rw-r--r--daemon/network.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/daemon/network.c b/daemon/network.c
index 26bd72fd..78dab48e 100644
--- a/daemon/network.c
+++ b/daemon/network.c
@@ -50,11 +50,6 @@ void network_init(struct network *net, uv_loop_t *loop)
}
}
-static void free_handle(uv_handle_t *handle)
-{
- free(handle);
-}
-
static void close_handle(uv_handle_t *handle, bool force)
{
if (force) { /* Force close if event loop isn't running. */
@@ -62,9 +57,10 @@ static void close_handle(uv_handle_t *handle, bool force)
if (uv_fileno(handle, &fd) == 0) {
close(fd);
}
- free_handle(handle);
+ handle->loop = NULL;
+ io_free(handle);
} else { /* Asynchronous close */
- uv_close(handle, free_handle);
+ uv_close(handle, io_free);
}
}