summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-12-01 19:51:41 +0100
committerThomas Haller <thaller@redhat.com>2023-12-01 19:52:03 +0100
commit7912b4f90668afab9b7cb7054434d341826b8c54 (patch)
tree4515e7cf78329881212656e690b73f2864d1d154
parentefd65feb9c3b694483127705daaa9465f63a5c8c (diff)
downloadlibnl-7912b4f90668afab9b7cb7054434d341826b8c54.tar.gz
route/cls: fix leak in error handling of rtnl_flower_append_action()
Using rtnl_act_append() correctly is hard. Fixes: ef46de143206 ('route/cls: add flower classifier')
-rw-r--r--lib/route/cls/flower.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/route/cls/flower.c b/lib/route/cls/flower.c
index e0a98e97..ad86ce98 100644
--- a/lib/route/cls/flower.c
+++ b/lib/route/cls/flower.c
@@ -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;
@@ -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;
}
/**