diff options
author | kib <kib@FreeBSD.org> | 2016-02-06 15:39:04 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-02-06 15:39:04 +0000 |
commit | ec36b5bf6457a82c80c259ad36edf68826ade8e7 (patch) | |
tree | f43fec8ec55d54a727837f715f3fd60080075af0 | |
parent | 1cb81502033e8887257dd52c0b57721abdd24839 (diff) | |
download | FreeBSD-src-ec36b5bf6457a82c80c259ad36edf68826ade8e7.zip FreeBSD-src-ec36b5bf6457a82c80c259ad36edf68826ade8e7.tar.gz |
Do not call vn_fullpath(9) (through the pmc_getfilename() wrapper)
when its result is immediately ignored, i.e. for kernel processes
forked from the user process. Do not test for non-null before freeing
string.
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
-rw-r--r-- | sys/dev/hwpmc/hwpmc_mod.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 7f46573..3f56f12 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -1009,14 +1009,14 @@ pmc_attach_one_process(struct proc *p, struct pmc *pm) /* issue an attach event to a configured log file */ if (pm->pm_owner->po_flags & PMC_PO_OWNS_LOGFILE) { - pmc_getfilename(p->p_textvp, &fullpath, &freepath); if (p->p_flag & P_KTHREAD) { fullpath = kernelname; freepath = NULL; - } else + } else { + pmc_getfilename(p->p_textvp, &fullpath, &freepath); pmclog_process_pmcattach(pm, p->p_pid, fullpath); - if (freepath) - free(freepath, M_TEMP); + } + free(freepath, M_TEMP); if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) pmc_log_process_mappings(pm->pm_owner, p); } |