mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 03:49:02 +00:00
Fix two memory leaks in syslogd
A memory leak in syslogd for processing of forward actions was reported. This modification adapts the patch submitted with that bug to fix the leak. While testing the modification, another leak was also found and fixed. PR: 198385 Submitted by: Sreeram <sreeramabs@yahoo.com> Reported by: Sreeram <sreeramabs@yahoo.com> Reviewed by: hrs MFC after: 1 week Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D14510
This commit is contained in:
parent
e89ef0620a
commit
9176635592
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330034
@ -180,7 +180,7 @@ static STAILQ_HEAD(, socklist) shead = STAILQ_HEAD_INITIALIZER(shead);
|
||||
* This structure represents the files that will have log
|
||||
* copies printed.
|
||||
* We require f_file to be valid if f_type is F_FILE, F_CONSOLE, F_TTY
|
||||
* or if f_type if F_PIPE and f_pid > 0.
|
||||
* or if f_type is F_PIPE and f_pid > 0.
|
||||
*/
|
||||
|
||||
struct filed {
|
||||
@ -382,10 +382,16 @@ close_filed(struct filed *f)
|
||||
return;
|
||||
|
||||
switch (f->f_type) {
|
||||
case F_FILE:
|
||||
case F_FORW:
|
||||
if (f->f_un.f_forw.f_addr) {
|
||||
freeaddrinfo(f->f_un.f_forw.f_addr);
|
||||
f->f_un.f_forw.f_addr = NULL;
|
||||
}
|
||||
/*FALLTHROUGH*/
|
||||
|
||||
case F_FILE:
|
||||
case F_TTY:
|
||||
case F_CONSOLE:
|
||||
case F_FORW:
|
||||
f->f_type = F_UNUSED;
|
||||
break;
|
||||
case F_PIPE:
|
||||
@ -1859,6 +1865,7 @@ readconfigfile(FILE *cf, int allow_includes)
|
||||
f = cfline(cline, prog, host);
|
||||
if (f != NULL)
|
||||
addfile(f);
|
||||
free(f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1956,9 +1963,11 @@ init(int signo)
|
||||
f = cfline("*.ERR\t/dev/console", "*", "*");
|
||||
if (f != NULL)
|
||||
addfile(f);
|
||||
free(f);
|
||||
f = cfline("*.PANIC\t*", "*", "*");
|
||||
if (f != NULL)
|
||||
addfile(f);
|
||||
free(f);
|
||||
Initialized = 1;
|
||||
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user