HomeFreeBSD

syslogd: Fix resource leaks

Description

syslogd: Fix resource leaks

  • nvlist_append_nvlist_array() makes a copy of the input nvlist, so the pattern of nvlist_append_nvlist_array(... cfline(...)) would leak memory and descriptors. Pass the entire config nvlist to cfline() instead since this is needed for a future change.
  • In parse_action(), free the linked list returned by getaddrinfo().
  • Remove some checks at the beginning of close_filed(). For some log types we'll always have f->f_file == -1, in which case we wouldn't release other resources, such as forwarding sockets.
  • After converting a filed to an nvlist, free the filed resources.

Fixes: 2567168dc498 ("syslogd: Refresh configuration using libcasper")
Reviewed by: jfree
Differential Revision: https://reviews.freebsd.org/D48250

Details

Provenance
markjAuthored on Fri, Jan 3, 1:51 AM
Reviewer
jfree
Differential Revision
D48250: syslogd: Fix resource leaks
Parents
rG1da99b479a74: syslogd tests: Permit starting syslogd with multiple -b options
Branches
Unknown
Tags
Unknown