socket-handler: fix leak if we exit with multiple clients
sh->n_clients is decremented by client_close(), so don't iterate through
the array.
Change-Id: Id44b596a483758fb8218d472a3ac411c04aacd74
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
diff --git a/socket-handler.c b/socket-handler.c
index af43989..a0b3028 100644
--- a/socket-handler.c
+++ b/socket-handler.c
@@ -355,10 +355,9 @@
static void socket_fini(struct handler *handler)
{
struct socket_handler *sh = to_socket_handler(handler);
- int i;
- for (i = 0; i < sh->n_clients; i++)
- client_close(sh, sh->clients[i]);
+ while (sh->n_clients)
+ client_close(sh, sh->clients[0]);
if (sh->poller)
console_unregister_poller(sh->console, sh->poller);