summaryrefslogtreecommitdiffstats
path: root/pcp
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-06-10 11:25:31 +1000
committerBenBE <BenBE@geshi.org>2021-06-13 19:51:00 +0200
commit0bd1025e94887dbdf6b31b1bdb2e07829108fa25 (patch)
tree725f3ef181da9aac1656dffc16d59aef262944cd /pcp
parentdf752dd189c07738a88d2b74d4796613a9157dc3 (diff)
Resolve a couple of recent memory leaks in pcp-htop
Makes the pcp-htop binary valgrind-clean once more.
Diffstat (limited to 'pcp')
-rw-r--r--pcp/Platform.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pcp/Platform.c b/pcp/Platform.c
index 1c2432ca..072ec50e 100644
--- a/pcp/Platform.c
+++ b/pcp/Platform.c
@@ -370,6 +370,10 @@ void Metric_enableThreads(void) {
}
bool Metric_fetch(struct timeval *timestamp) {
+ if (pcp->result) {
+ pmFreeResult(pcp->result);
+ pcp->result = NULL;
+ }
int sts = pmFetch(pcp->total, pcp->fetch, &pcp->result);
if (sts < 0) {
if (pmDebugOptions.appl0)
@@ -502,6 +506,8 @@ void Platform_init(void) {
void Platform_done(void) {
pmDestroyContext(pcp->context);
+ pmFreeResult(pcp->result);
+ free(pcp->release);
free(pcp->fetch);
free(pcp->pmids);
free(pcp->names);

© 2014-2024 Faster IT GmbH | imprint | privacy policy