summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-12-01 16:15:13 (GMT)
committerThomas Haller <thaller@redhat.com>2023-12-01 16:16:14 (GMT)
commita70f789a79d734979af8610dadb3e2ee42e6b6ee (patch)
tree0f9cbb50d3e0c054aea09de516f0eaba55336dae /lib
parent65ab16f23b553ba09b168a961a0b77de341f470d (diff)
downloadlibnl-a70f789a79d734979af8610dadb3e2ee42e6b6ee.zip
libnl-a70f789a79d734979af8610dadb3e2ee42e6b6ee.tar.gz
libnl-a70f789a79d734979af8610dadb3e2ee42e6b6ee.tar.bz2
route: fix memleak in rtnl_act_parse()
Coverity warns: Error: RESOURCE_LEAK (CWE-772): [#def2] libnl-3.8.0/lib/route/act.c:421: alloc_fn: Storage is returned from allocation function "rtnl_act_alloc". libnl-3.8.0/lib/route/act.c:421: var_assign: Assigning: "act" = storage returned from "rtnl_act_alloc()". libnl-3.8.0/lib/route/act.c:426: var_assign: Assigning: "tc" = "act". libnl-3.8.0/lib/route/act.c:438: noescape: Resource "tc" is not freed or pointed-to in "rtnl_tc_set_kind". libnl-3.8.0/lib/route/act.c:455: leaked_storage: Variable "tc" going out of scope leaks the storage it points to. libnl-3.8.0/lib/route/act.c:455: leaked_storage: Variable "act" going out of scope leaks the storage it points to. # 453| tc_act_stats_policy); # 454| if (err < 0) # 455|-> return err; # 456| # 457| if (tb3[TCA_STATS_BASIC]) { Fixes: 05bd6366387c ('add support for TC action statistics')
Diffstat (limited to 'lib')
-rw-r--r--lib/route/act.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/route/act.c b/lib/route/act.c
index ffee827..e5bdce0 100644
--- a/lib/route/act.c
+++ b/lib/route/act.c
@@ -452,7 +452,7 @@ int rtnl_act_parse(struct rtnl_act **head, struct nlattr *tb)
err = nla_parse_nested(tb3, TCA_STATS_MAX, tb2[TCA_ACT_STATS],
tc_act_stats_policy);
if (err < 0)
- return err;
+ goto err_free;
if (tb3[TCA_STATS_BASIC]) {
struct gnet_stats_basic bs;