diff options
author | jkoshy <jkoshy@FreeBSD.org> | 2006-01-17 16:53:50 +0000 |
---|---|---|
committer | jkoshy <jkoshy@FreeBSD.org> | 2006-01-17 16:53:50 +0000 |
commit | b12ec6b7ed4f791a27a5b65c12d5e1f21fa43ece (patch) | |
tree | 6da630d637a5fd81d71b06c955449d200be251ce /sys/dev/hwpmc | |
parent | b24626498e03b6b9f6a3a0d5a7e5a85a04c4c6d4 (diff) | |
download | FreeBSD-src-b12ec6b7ed4f791a27a5b65c12d5e1f21fa43ece.zip FreeBSD-src-b12ec6b7ed4f791a27a5b65c12d5e1f21fa43ece.tar.gz |
Fix a memory leak.
Found by: Coverity
Diffstat (limited to 'sys/dev/hwpmc')
-rw-r--r-- | sys/dev/hwpmc/hwpmc_mod.c | 12 |
1 files changed, 7 insertions, 5 deletions
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) { |