Skip to content

Commit

Permalink
route: fix memleak in rtnl_act_parse()
Browse files Browse the repository at this point in the history
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: 05bd636 ('add support for TC action statistics')
  • Loading branch information
thom311 committed Dec 1, 2023
1 parent 65ab16f commit a70f789
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/route/act.c
Expand Up @@ -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;
Expand Down

0 comments on commit a70f789

Please sign in to comment.