diff options
author | davide <davide@FreeBSD.org> | 2013-04-30 08:33:38 +0000 |
---|---|---|
committer | davide <davide@FreeBSD.org> | 2013-04-30 08:33:38 +0000 |
commit | cce56d6bd8491ef150749219988548c2180a3056 (patch) | |
tree | cdd16e58fa601daa2838277f90f59f393a6789e0 /sys/dev/hwpmc | |
parent | 3569f976bfe32ceb8d933c30069e0b734be0f3b5 (diff) | |
download | FreeBSD-src-cce56d6bd8491ef150749219988548c2180a3056.zip FreeBSD-src-cce56d6bd8491ef150749219988548c2180a3056.tar.gz |
When hwpmc(4) module is unloaded it reports a double leakage. This happens
at least if FreeBSD is ran under VirtualBox. In order to avoid the leakage,
properly deallocate structures in case CPU claims that hw performance
monitoring counters are not supported.
Reported by: hiren
Diffstat (limited to 'sys/dev/hwpmc')
-rw-r--r-- | sys/dev/hwpmc/hwpmc_intel.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/dev/hwpmc/hwpmc_intel.c b/sys/dev/hwpmc/hwpmc_intel.c index 9a1e47f..62a1e52 100644 --- a/sys/dev/hwpmc/hwpmc_intel.c +++ b/sys/dev/hwpmc/hwpmc_intel.c @@ -87,7 +87,7 @@ pmc_intel_initialize(void) cputype = -1; nclasses = 2; - + error = 0; model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); switch (cpu_id & 0xF00) { @@ -192,10 +192,6 @@ pmc_intel_initialize(void) ncpus = pmc_cpu_max(); - error = pmc_tsc_initialize(pmc_mdep, ncpus); - if (error) - goto error; - switch (cputype) { #if defined(__i386__) || defined(__amd64__) /* @@ -271,10 +267,10 @@ pmc_intel_initialize(void) break; } #endif - + error = pmc_tsc_initialize(pmc_mdep, ncpus); error: if (error) { - free(pmc_mdep, M_PMC); + pmc_mdep_free(pmc_mdep); pmc_mdep = NULL; } |