From c388d9adae20b835731ac98776082c884617467d Mon Sep 17 00:00:00 2001 From: Lee Duncan Date: Thu, 30 Aug 2018 15:58:10 -0700 Subject: [PATCH 45/91] Plugging a memory leak from discovery. During discovery the function get_op_params_text_keys() can allocate a target_alias, but this is never freed. Discovered-by: zhangzujian.7@gmail.com --- usr/discovery.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr/discovery.c b/usr/discovery.c index 8001af6..2147deb 100644 --- a/usr/discovery.c +++ b/usr/discovery.c @@ -1055,6 +1055,11 @@ static void iscsi_destroy_session(struct iscsi_session *session) log_error("Could not safely destroy session %d (err %d)", session->id, rc); done: + if (session->target_alias) { + free(session->target_alias); + session->target_alias = NULL; + } + if (conn->socket_fd >= 0) { ipc->ctldev_close(); conn->socket_fd = -1; -- 1.8.3.1