rdma: Avoid memory leak for skipper resource

The call to get_task_name() allocates memory which is not freed
in case of skipping the object.

Fixes: 8ecac46a60 ("rdma: Add QP resource tracking information")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Leon Romanovsky 2018-02-20 14:47:18 +02:00 committed by Stephen Hemminger
parent 58b48c5d75
commit 4ac152d003
1 changed files with 3 additions and 1 deletions

View File

@ -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 */