Commit 35d1a938 authored by Sagi Grimberg's avatar Sagi Grimberg

nvmet-tcp: fix possible memory leak

when we uninit a command in error flow we also need to
free an iovec if it was allocated.
Reviewed-by: default avatarMax Gurtovoy <maxg@mellanox.com>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
parent b6272007
...@@ -1309,6 +1309,7 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd) ...@@ -1309,6 +1309,7 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd)
{ {
nvmet_req_uninit(&cmd->req); nvmet_req_uninit(&cmd->req);
nvmet_tcp_unmap_pdu_iovec(cmd); nvmet_tcp_unmap_pdu_iovec(cmd);
kfree(cmd->iov);
if (cmd->req.sg_cnt) if (cmd->req.sg_cnt)
sgl_free(cmd->req.sg); sgl_free(cmd->req.sg);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment