summaryrefslogtreecommitdiffstats
path: root/pcp
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2023-09-01 09:40:51 +1000
committerNathan Scott <nathans@redhat.com>2023-09-04 08:59:51 +1000
commitde1d3e17aff864a58cb7f6da6efff7b7bde6182a (patch)
tree41110e071957d870e898571b39220152bedbfad6 /pcp
parent66c0b19ed6fec2afd4ed381665274fa83c67660e (diff)
Ensure possible NULL pointer values dealt with defensively
Coverity scanning shows a couple of locations where a NULL pointer dereference could happen; updated code to ensure it cannot.
Diffstat (limited to 'pcp')
-rw-r--r--pcp/Instance.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pcp/Instance.c b/pcp/Instance.c
index e70e7b70..1515dfe6 100644
--- a/pcp/Instance.c
+++ b/pcp/Instance.c
@@ -62,10 +62,12 @@ static void Instance_writeField(const Row* super, RichString* str, RowField fiel
const Settings* settings = super->host->settings;
DynamicColumn* column = Hashtable_get(settings->dynamicColumns, field);
PCPDynamicColumn* cp = (PCPDynamicColumn*) column;
- const pmDesc* descp = Metric_desc(cp->id);
+ if (!cp)
+ return;
pmAtomValue atom;
pmAtomValue *ap = &atom;
+ const pmDesc* descp = Metric_desc(cp->id);
if (!Metric_instance(cp->id, instid, this->offset, ap, descp->type))
ap = NULL;

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