Page MenuHomeFreeBSD

syslogd: Fix resource leaks
ClosedPublic

Authored by markj on Mon, Dec 30, 2:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jan 5, 11:50 PM
Unknown Object (File)
Sun, Jan 5, 11:08 PM
Unknown Object (File)
Sun, Jan 5, 7:45 AM
Unknown Object (File)
Sun, Jan 5, 7:30 AM
Unknown Object (File)
Fri, Jan 3, 10:55 PM
Unknown Object (File)
Fri, Jan 3, 10:22 PM
Unknown Object (File)
Fri, Jan 3, 4:27 AM
Unknown Object (File)
Mon, Dec 30, 5:52 PM
Subscribers

Details

Summary
  • 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")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Mon, Dec 30, 2:07 PM

Thanks for finding and fixing all of these.

usr.sbin/syslogd/syslogd.c
2448

Wow. This was a bad oversight on my part... Big memory leak. :(

This revision is now accepted and ready to land.Thu, Jan 2, 10:34 PM
This revision was automatically updated to reflect the committed changes.