summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-10-10 08:59:27 (GMT)
committerThomas Haller <thaller@redhat.com>2018-10-10 08:59:48 (GMT)
commit1bffe3cc6739d95c1a42f12b417e98f9d6ee5e80 (patch)
tree7b576ea842d1fc0baa78a9e86bc59fcfbf9fa46c /lib
parent8faa8659ec154d6efc9d61a7b559b74236a19a9c (diff)
downloadlibnl-1bffe3cc6739d95c1a42f12b417e98f9d6ee5e80.zip
libnl-1bffe3cc6739d95c1a42f12b417e98f9d6ee5e80.tar.gz
libnl-1bffe3cc6739d95c1a42f12b417e98f9d6ee5e80.tar.bz2
lib/tc: fix uninitalized err variable in rtnl_tc_msg_build()
Fixes: 52cd3c14ce42db53637f8f5dafaf0d5c24d724db
Diffstat (limited to 'lib')
-rw-r--r--lib/route/tc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/route/tc.c b/lib/route/tc.c
index 061e54e..694c48e 100644
--- a/lib/route/tc.c
+++ b/lib/route/tc.c
@@ -210,11 +210,11 @@ int rtnl_tc_msg_build(struct rtnl_tc *tc, int type, int flags,
if (nlmsg_append(msg, &tchdr, sizeof(tchdr), NLMSG_ALIGNTO) < 0) {
err = -NLE_MSGSIZE;
- goto nla_put_failure;
+ goto out_err;
}
if (tc->ce_mask & TCA_ATTR_KIND)
- NLA_PUT_STRING(msg, TCA_KIND, tc->tc_kind);
+ NLA_PUT_STRING(msg, TCA_KIND, tc->tc_kind);
ops = rtnl_tc_get_ops(tc);
if (ops && (ops->to_msg_fill || ops->to_msg_fill_raw)) {
@@ -224,24 +224,26 @@ int rtnl_tc_msg_build(struct rtnl_tc *tc, int type, int flags,
if (ops->to_msg_fill) {
if (!(opts = nla_nest_start(msg, TCA_OPTIONS))) {
err = -NLE_NOMEM;
- goto nla_put_failure;
+ goto out_err;
}
if ((err = ops->to_msg_fill(tc, data, msg)) < 0)
- goto nla_put_failure;
+ goto out_err;
if (strcmp("cgroup", tc->tc_kind))
nla_nest_end(msg, opts);
else
nla_nest_end_keep_empty(msg, opts);
} else if ((err = ops->to_msg_fill_raw(tc, data, msg)) < 0)
- goto nla_put_failure;
+ goto out_err;
}
*result = msg;
return 0;
nla_put_failure:
+ err = -NLE_NOMEM;
+out_err:
nlmsg_free(msg);
return err;
}