Message ID | 20240207201900.8813-1-maks.mishinFZ@gmail.com (mailing list archive) |
---|---|
State | Rejected |
Delegated to: | Stephen Hemminger |
Headers | show |
Series | iprule: Fix descriptor leak in flush_rule() | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
diff --git a/ip/iprule.c b/ip/iprule.c index e503e5c6..ce40726a 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -534,8 +534,10 @@ static int flush_rule(struct nlmsghdr *n, void *arg) n->nlmsg_type = RTM_DELRULE; n->nlmsg_flags = NLM_F_REQUEST; - if (rtnl_open(&rth2, 0) < 0) + if (rtnl_open(&rth2, 0) < 0) { + rtnl_close(&rth2); return -1; + } if (rtnl_talk(&rth2, n, NULL) < 0) return -2;
Added closure of file descriptor `rth2` when returning from function. Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com> --- ip/iprule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)