diff --git a/appl/kx/kxd.c b/appl/kx/kxd.c index d5a013f24..190393678 100644 --- a/appl/kx/kxd.c +++ b/appl/kx/kxd.c @@ -680,13 +680,14 @@ doit(int sock, int tcp_flag) flags = recv_conn (sock, &context, &dispnr, &nsockets, &sockets, tcp_flag); - if (flags & PASSIVE) + if (flags & PASSIVE) { ret = doit_passive (&context, sock, flags, dispnr, nsockets, sockets, tcp_flag); - else + } else { ret = doit_active (&context, sock, flags, tcp_flag); + cleanup(nsockets, sockets); + } context_destroy (&context); - cleanup(nsockets, sockets); return ret; }