From e3d0fc1a5a705665c26a4a703c5b082d337da533 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Fri, 11 Jun 2021 13:30:31 +1000 Subject: Fix a PCP diagnostics typo, add missing pmFreeResult null check. --- pcp/Platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pcp/Platform.c b/pcp/Platform.c index 072ec50e..42db6be1 100644 --- a/pcp/Platform.c +++ b/pcp/Platform.c @@ -377,7 +377,7 @@ bool Metric_fetch(struct timeval *timestamp) { int sts = pmFetch(pcp->total, pcp->fetch, &pcp->result); if (sts < 0) { if (pmDebugOptions.appl0) - fprintf(stderr, "Error: cannot fetch metric values): %s\n", + fprintf(stderr, "Error: cannot fetch metric values: %s\n", pmErrStr(sts)); return false; } @@ -506,7 +506,8 @@ void Platform_init(void) { void Platform_done(void) { pmDestroyContext(pcp->context); - pmFreeResult(pcp->result); + if (pcp->result) + pmFreeResult(pcp->result); free(pcp->release); free(pcp->fetch); free(pcp->pmids); -- cgit v1.2.3