libpmc: don't leak string in error case either
Reported by: vangyzen@
This commit is contained in:
parent
bf90190d27
commit
e62a5de88f
@ -2795,11 +2795,12 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode,
|
||||
r = spec_copy = strdup(ctrspec);
|
||||
ctrname = strsep(&r, ",");
|
||||
if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) {
|
||||
if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0)
|
||||
return (errno);
|
||||
free(spec_copy);
|
||||
if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) {
|
||||
retval = errno;
|
||||
goto out;
|
||||
}
|
||||
*pmcid = pmc_config.pm_pmcid;
|
||||
return (0);
|
||||
goto out;
|
||||
} else {
|
||||
free(spec_copy);
|
||||
spec_copy = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user