From b12ec6b7ed4f791a27a5b65c12d5e1f21fa43ece Mon Sep 17 00:00:00 2001 From: jkoshy Date: Tue, 17 Jan 2006 16:53:50 +0000 Subject: Fix a memory leak. Found by: Coverity --- sys/dev/hwpmc/hwpmc_mod.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sys/dev/hwpmc') diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 97af35d..2a8b0fb 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -1486,17 +1486,19 @@ pmc_hook_handler(struct thread *td, int function, void *arg) } /* - * If this process is the target of a PMC, check if the new - * credentials are compatible with the owner's permissions. + * If the process being exec'ed is not the target of any + * PMC, we are done. */ - - if ((pp = pmc_find_process_descriptor(p, 0)) == NULL) + if ((pp = pmc_find_process_descriptor(p, 0)) == NULL) { + if (freepath) + FREE(freepath, M_TEMP); break; + } /* * Log the exec event to all monitoring owners. Skip * owners who have already recieved the event because - * the have system sampling PMCs active. + * they had system sampling PMCs active. */ for (ri = 0; ri < md->pmd_npmc; ri++) if ((pm = pp->pp_pmcs[ri].pp_pmc) != NULL) { -- cgit v1.1