Commit addf898e authored by Marek Vavrusa's avatar Marek Vavrusa

daemon: fixed socket mempool cleanup on exit

fixes #73 small leak in cleaning up per-socket
mempool on daemon exit
parent be1bdf6e
......@@ -54,8 +54,10 @@ static void session_clear(struct session *s)
void session_free(struct session *s)
{
session_clear(s);
free(s);
if (s) {
session_clear(s);
free(s);
}
}
struct session *session_new(void)
......
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment