* [PATCH iproute2] rdma: Avoid memory leak for skipper resource
@ 2018-02-20 12:47 Leon Romanovsky
2018-02-23 16:43 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2018-02-20 12:47 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Leon Romanovsky, David Ahern, netdev
From: Leon Romanovsky <leonro@mellanox.com>
The call to get_task_name() allocates memory which is not freed
in case of skipping the object.
Fixes: 8ecac46a60ff ("rdma: Add QP resource tracking information")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
rdma/res.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/rdma/res.c b/rdma/res.c
index 2a63e712..62f5c544 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -395,8 +395,10 @@ static int res_qp_parse_cb(const struct nlmsghdr *nlh, void *data)
comm = get_task_name(pid);
}
- if (rd_check_is_filtered(rd, "pid", pid))
+ if (rd_check_is_filtered(rd, "pid", pid)) {
+ free(comm);
continue;
+ }
if (nla_line[RDMA_NLDEV_ATTR_RES_KERN_NAME])
/* discard const from mnl_attr_get_str */
--
2.16.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] rdma: Avoid memory leak for skipper resource
2018-02-20 12:47 [PATCH iproute2] rdma: Avoid memory leak for skipper resource Leon Romanovsky
@ 2018-02-23 16:43 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2018-02-23 16:43 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: Leon Romanovsky, David Ahern, netdev
On Tue, 20 Feb 2018 14:47:18 +0200
Leon Romanovsky <leon@kernel.org> wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> The call to get_task_name() allocates memory which is not freed
> in case of skipping the object.
>
> Fixes: 8ecac46a60ff ("rdma: Add QP resource tracking information")
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-23 16:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-20 12:47 [PATCH iproute2] rdma: Avoid memory leak for skipper resource Leon Romanovsky
2018-02-23 16:43 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).