Skip to content

Commit

Permalink
route/cls: fix leak in error handling of rtnl_flower_append_action()
Browse files Browse the repository at this point in the history
Using rtnl_act_append() correctly is hard.

Fixes: ef46de1 ('route/cls: add flower classifier')
  • Loading branch information
thom311 committed Dec 1, 2023
1 parent efd65fe commit 7912b4f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/route/cls/flower.c
Expand Up @@ -809,6 +809,7 @@ int rtnl_flower_get_ipv4_dst(struct rtnl_cls *cls, in_addr_t *out_addr,
int rtnl_flower_append_action(struct rtnl_cls *cls, struct rtnl_act *act)
{
struct rtnl_flower *f;
int err;

if (!act)
return 0;
Expand All @@ -818,8 +819,11 @@ int rtnl_flower_append_action(struct rtnl_cls *cls, struct rtnl_act *act)

f->cf_mask |= FLOWER_ATTR_ACTION;

if ((err = rtnl_act_append(&f->cf_act, act)) < 0)
return err;

rtnl_act_get(act);
return rtnl_act_append(&f->cf_act, act);
return 0;
}

/**
Expand Down

0 comments on commit 7912b4f

Please sign in to comment.