From 23ab9ac224056a2efef00b20cfc973c8e98a1e1d Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Fri, 26 Nov 2021 09:51:52 +0800
Subject: [PATCH 07/14] fix cri libwebsockets sync_close_sem memory leak

Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
 src/daemon/entry/cri/websocket/service/ws_server.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/daemon/entry/cri/websocket/service/ws_server.cc b/src/daemon/entry/cri/websocket/service/ws_server.cc
index 509f821e..e4b3a1b4 100644
--- a/src/daemon/entry/cri/websocket/service/ws_server.cc
+++ b/src/daemon/entry/cri/websocket/service/ws_server.cc
@@ -191,6 +191,8 @@ void WebsocketServer::CloseWsSession(int socketID)
         }
         (void)sem_wait(session->sync_close_sem);
         (void)sem_destroy(session->sync_close_sem);
+        delete session->sync_close_sem;
+        session->sync_close_sem = nullptr;
         close(session->pipes.at(0));
         delete session->session_mutex;
         session->session_mutex = nullptr;
-- 
2.25.1

