diff options
author | Nathan Scott <nathans@redhat.com> | 2021-09-03 12:11:31 +1000 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-09-03 09:47:01 +0200 |
commit | c0c2bb98a23b649c55e5d8a55395073fdaa8d6fa (patch) | |
tree | 5d568468338201447d1396843e761d33c6729b37 /pcp/PCPDynamicColumn.c | |
parent | 9b30870eeca0e2fd29602451205834d753ed5905 (diff) |
Add completion handling for dynamic meters and columns
Be sure to free dynamic memory allocated for meters and
columns strings, no-op on platforms other than pcp.
Closes #774
Diffstat (limited to 'pcp/PCPDynamicColumn.c')
-rw-r--r-- | pcp/PCPDynamicColumn.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pcp/PCPDynamicColumn.c b/pcp/PCPDynamicColumn.c index 3c4e6797..29dc9f91 100644 --- a/pcp/PCPDynamicColumn.c +++ b/pcp/PCPDynamicColumn.c @@ -226,6 +226,18 @@ void PCPDynamicColumns_init(PCPDynamicColumns* columns) { free(path); } +static void PCPDynamicColumns_free(ATTR_UNUSED ht_key_t key, void* value, ATTR_UNUSED void* data) { + PCPDynamicColumn* column = (PCPDynamicColumn*) value; + free(column->metricName); + free(column->super.heading); + free(column->super.caption); + free(column->super.description); +} + +void PCPDynamicColumns_done(Hashtable* table) { + Hashtable_foreach(table, PCPDynamicColumns_free, NULL); +} + void PCPDynamicColumn_writeField(PCPDynamicColumn* this, const Process* proc, RichString* str) { const PCPProcess* pp = (const PCPProcess*) proc; unsigned int type = PCPMetric_type(this->id); |