git: fe291141486a - main - syslogd: Fix issues reported by gcc
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 30 Nov 2024 18:52:42 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fe291141486acf27ed1c8eed791ba9897f84c3f0 commit fe291141486acf27ed1c8eed791ba9897f84c3f0 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-11-29 19:43:42 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-11-30 18:52:34 +0000 syslogd: Fix issues reported by gcc - When forwaring a message, don't assume that f->f_num_addr_fds > 0. - Avoid calling free() on a stack-allocated object. Fixes: 4ecbee2760f7 ("syslogd: Open forwarding socket descriptors") Fixes: f4b4a10abb26 ("syslogd: Move selector parsing into its own function") Reviewed by: jfree Differential Revision: https://reviews.freebsd.org/D47844 --- usr.sbin/syslogd/syslogd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 0e063b72beb6..23ef5d78c319 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1795,6 +1795,7 @@ fprintlog_write(struct filed *f, struct iovlist *il, int flags) iovlist_truncate(il, MaxForwardLen); #endif + lsent = 0; for (size_t i = 0; i < f->f_num_addr_fds; ++i) { struct msghdr msg = { .msg_iov = il->iov, @@ -2941,7 +2942,6 @@ parse_selector(const char *p, struct filed *f) pri = decode(buf, prioritynames); if (pri < 0) { dprintf("unknown priority name \"%s\"", buf); - free(f); return (NULL); } } @@ -2965,7 +2965,6 @@ parse_selector(const char *p, struct filed *f) i = decode(buf, facilitynames); if (i < 0) { dprintf("unknown facility name \"%s\"", buf); - free(f); return (NULL); } f->f_pmask[i >> 3] = pri;