Clean up the cfline() function by moving the prop_filter memory allocation into the prop_filter_compile() function.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
usr.sbin/syslogd/syslogd.c | ||
---|---|---|
2851–2852 | These frees are in the wrong order. It'd be nicer to have a dedicated error path: goto error; ... error: free(pfilter->pflt_re); // pfilter is zero-initialized, and free(NULL) is fine. free(pfilter); return (NULL); | |
2930–2931 | Why not move the strdup() into prop_filter_compile() as well? |
Comment Actions
In prop_filter_compile(), the filter string pointer is modified so free()'ing it leads to unintended behavior. Save a filter_begpos pointer and free() that during cleanup.