[PATCH 1/1] route/link: fix memleaks in link_msg_parser()
Thomas Haller
thaller at redhat.com
Wed May 13 05:46:08 PDT 2015
Signed-off-by: Thomas Haller <thaller at redhat.com>
---
lib/route/link.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/route/link.c b/lib/route/link.c
index 0b3238f..d66a798 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -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;
@@ -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]);
--
2.1.0
More information about the libnl
mailing list