aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJoseph Koshy <jkoshy@FreeBSD.org>2006-01-17 16:53:50 +0000
committerJoseph Koshy <jkoshy@FreeBSD.org>2006-01-17 16:53:50 +0000
commit2b01a084466ca64360ccff6a9139528eff2ae454 (patch)
tree6da630d637a5fd81d71b06c955449d200be251ce /sys
parent550d1c93925bd9f6263a85fb377d6e7298cfcf83 (diff)
downloadsrc-2b01a084466ca64360ccff6a9139528eff2ae454.tar.gz
src-2b01a084466ca64360ccff6a9139528eff2ae454.zip
Fix a memory leak.
Found by: Coverity
Notes
Notes: svn path=/head/; revision=154483
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/hwpmc/hwpmc_mod.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index 97af35dddb7a..2a8b0fb65333 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) {