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