Bug 1182 - Resource leak (socket)
Resource leak (socket)
Product: unbound
Classification: Unclassified
Component: server
All All
: P5 minor
Assigned To: unbound team
Depends on:
  Show dependency treegraph
Reported: 2016-12-13 13:06 CET by Ricardo Mestre
Modified: 2016-12-13 13:57 CET (History)
2 users (show)

See Also:

Close socket so that it doesn't leak (1.17 KB, application/octet-stream)
2016-12-13 13:06 CET, Ricardo Mestre

Note You need to log in before you can comment on or make changes to this bug.
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