Skip to content
Snippets Groups Projects
Commit 2679f1f4 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Fixed handler destructor and memleak.

Handler destructor was called only if handler was brought down
while the server was running. Also it didn't free the context struct.

Change-Id: I8e71f4abc2bb314528416eeba063b48f2fb79773
parent d3ef6a9b
No related branches found
No related tags found
No related merge requests found
......@@ -386,11 +386,14 @@ int server_free_handler(iohandler_t *h)
if (!h || !h->server) return KNOT_EINVAL;
if (h->server->state & ServerRunning) {
dt_stop(h->unit);
if (h->dtor) h->dtor(h);
dt_join(h->unit);
}
/* Destroy dispatcher and worker */
if (h->dtor) {
h->dtor(h->data);
h->data = NULL;
}
dt_delete(&h->unit);
free(h->state);
memset(h, 0, sizeof(iohandler_t));
......
......@@ -515,6 +515,7 @@ void udp_free_ctx(void *ctx)
for (unsigned i = 0; i < _ctx->rqlen; ++i) {
_udp_deinit(_ctx->rqs[i]);
}
free(_ctx);
}
int udp_writer(iohandler_t *h, dthread_t *thread)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment