Bug 1182

Summary: Resource leak (socket)
Product: unbound Reporter: Ricardo Mestre <serial666>
Component: serverAssignee: unbound team <unbound-team>
Status: RESOLVED FIXED    
Severity: minor CC: cathya, wouter
Priority: P5    
Version: 1.5.9   
Hardware: All   
OS: All   
Attachments: Close socket so that it doesn't leak

Description Ricardo Mestre 2016-12-13 13:06:04 CET
Created attachment 367 [details]
Close socket so that it doesn't leak

In file services/listen_dnsport.c the function create_local_accept_sock seems to leak resource s (socket) whereas in function create_tcp_accept_sock that doesn't happen.

Please find attached a proposed diff, for your revision, to close the socket whenever an error is found.
Comment 1 Wouter Wijngaards 2016-12-13 13:57:14 CET
Hi Ricardo,

Thank you for the find and the fix.  I note that this routine is only called at startup, so the leak would not have accumulated.  The patch is great, and I have integrated it into the code repository.

Best regards, Wouter