* [PATCH] iprule: Fix descriptor leak in flush_rule()
@ 2024-02-07 20:19 Maks Mishin
0 siblings, 0 replies; only message in thread
From: Maks Mishin @ 2024-02-07 20:19 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Maks Mishin, netdev
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(-)
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;
--
2.30.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-07 20:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 20:19 [PATCH] iprule: Fix descriptor leak in flush_rule() Maks Mishin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.