Skip to content

Commit

Permalink
route/link: fix memleaks in link_msg_parser()
Browse files Browse the repository at this point in the history
http://lists.infradead.org/pipermail/libnl/2015-May/001880.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
  • Loading branch information
thom311 committed Jun 4, 2015
1 parent 4818248 commit 75dcd01
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/route/link.c
Expand Up @@ -495,8 +495,10 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,

link->ce_msgtype = n->nlmsg_type;

if (!nlmsg_valid_hdr(n, sizeof(*ifi)))
return -NLE_MSG_TOOSHORT;
if (!nlmsg_valid_hdr(n, sizeof(*ifi))) {
err = -NLE_MSG_TOOSHORT;
goto errout;
}

ifi = nlmsg_data(n);
link->l_family = family = ifi->ifi_family;
Expand All @@ -520,11 +522,11 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,

err = nlmsg_parse(n, sizeof(*ifi), tb, IFLA_MAX, real_link_policy);
if (err < 0)
return err;
goto errout;

err = rtnl_link_info_parse(link, tb);
if (err < 0)
return err;
goto errout;

if (tb[IFLA_NUM_VF]) {
link->l_num_vf = nla_get_u32(tb[IFLA_NUM_VF]);
Expand Down

0 comments on commit 75dcd01

Please sign in to comment.