syslogd: don't leak f on failure in cfline(..)

Free `f` if an unknown priority or facility is parsed with the function.

MFC after:	1 week
Reported by:	Coverity
CID:		1368068
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Enji Cooper 2017-03-20 04:25:40 +00:00
parent b49d92c2aa
commit 4863f2fc55

View File

@ -2117,6 +2117,7 @@ cfline(const char *line, const char *prog, const char *host)
(void)snprintf(ebuf, sizeof ebuf,
"unknown priority name \"%s\"", buf);
logerror(ebuf);
free(f);
return (NULL);
}
}
@ -2147,6 +2148,7 @@ cfline(const char *line, const char *prog, const char *host)
"unknown facility name \"%s\"",
buf);
logerror(ebuf);
free(f);
return (NULL);
}
f->f_pmask[i >> 3] = pri;