iprule: Fix descriptor leak in flush_rule()
Subsystems (2)
PATCH 1/1 iprule: Fix descriptor leak in flush_rule()
Added closure of file descriptor rth2 when returning from function.
Signed-off-by Maks Mishin <[email protected]>
--- ip/iprule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
ip/iprule.c +3 -1
@@ -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 ;
Signature · 1 line
2.30.2