Fix a PCP diagnostics typo, add missing pmFreeResult null check.

This commit is contained in:
Nathan Scott 2021-06-11 13:30:31 +10:00 committed by BenBE
parent 6f9b161b24
commit e3d0fc1a5a
1 changed files with 3 additions and 2 deletions

View File

@ -377,7 +377,7 @@ bool Metric_fetch(struct timeval *timestamp) {
int sts = pmFetch(pcp->total, pcp->fetch, &pcp->result); int sts = pmFetch(pcp->total, pcp->fetch, &pcp->result);
if (sts < 0) { if (sts < 0) {
if (pmDebugOptions.appl0) if (pmDebugOptions.appl0)
fprintf(stderr, "Error: cannot fetch metric values): %s\n", fprintf(stderr, "Error: cannot fetch metric values: %s\n",
pmErrStr(sts)); pmErrStr(sts));
return false; return false;
} }
@ -506,6 +506,7 @@ void Platform_init(void) {
void Platform_done(void) { void Platform_done(void) {
pmDestroyContext(pcp->context); pmDestroyContext(pcp->context);
if (pcp->result)
pmFreeResult(pcp->result); pmFreeResult(pcp->result);
free(pcp->release); free(pcp->release);
free(pcp->fetch); free(pcp->fetch);