libpmc: free allocated string on return from pmc_allocate

Reported by:	Coverity
CID: 1391359
This commit is contained in:
Matt Macy 2018-05-29 18:26:12 +00:00
parent b99aa0fbb2
commit 731ca83529

View File

@ -2797,6 +2797,7 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode,
if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) {
if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0)
return (errno);
free(spec_copy);
*pmcid = pmc_config.pm_pmcid;
return (0);
} else {