From efefd567959aecd2a060cf2de453a53692c30de4 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Thu, 18 Aug 2022 12:14:46 +0800 Subject: [PATCH] protocol: fix potential pty buf leak on process exit --- src/protocol.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/protocol.c b/src/protocol.c index 731b54f..5341c3d 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -363,9 +363,8 @@ int callback_tty(struct lws *wsi, enum lws_callback_reasons reason, void *user, server->client_count--; lwsl_notice("WS closed from %s, clients: %d\n", pss->address, server->client_count); - if (pss->buffer != NULL) { - free(pss->buffer); - } + if (pss->buffer != NULL) free(pss->buffer); + if (pss->pty_buf != NULL) pty_buf_free(pss->pty_buf); for (int i = 0; i < pss->argc; i++) { free(pss->args[i]); } -- 2.43.4