From a05ff040c0ba97b395da8af645d052413bfe1f8e Mon Sep 17 00:00:00 2001 From: linqiheng Date: Thu, 12 Jan 2023 13:03:52 +0000 Subject: [PATCH] hmdfs: fix memleak of outdata when recv message error case Signed-off-by: linqiheng --- fs/hmdfs/comm/connection.c | 2 +- fs/hmdfs/comm/socket_adapter.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/hmdfs/comm/connection.c b/fs/hmdfs/comm/connection.c index 5a2e5b0f5b02..7613da514c7c 100644 --- a/fs/hmdfs/comm/connection.c +++ b/fs/hmdfs/comm/connection.c @@ -706,7 +706,7 @@ void connection_handshake_recv_handler(struct connection *conn_impl, void *buf, } fallthrough; default: - return; + break; } out: kfree(data); diff --git a/fs/hmdfs/comm/socket_adapter.c b/fs/hmdfs/comm/socket_adapter.c index eff3d3e1c044..3f703954125c 100644 --- a/fs/hmdfs/comm/socket_adapter.c +++ b/fs/hmdfs/comm/socket_adapter.c @@ -1082,7 +1082,7 @@ static void hmdfs_recv_mesg_callback(struct hmdfs_peer *con, void *head, default: hmdfs_err("Fatal! Unexpected msg cmd %d", hmdfs_head->operations.cmd_flag); - break; + goto out_err; } return; -- Gitee