summaryrefslogtreecommitdiffstats
path: root/ml
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2022-04-12 17:40:25 +0300
committerGitHub <noreply@github.com>2022-04-12 17:40:25 +0300
commite36fbebaa205c1c3c2304a8395e74a118bcca17b (patch)
tree24734ccc57839f9b8f6edb8c97513bb7f05183dd /ml
parent9e4ab2b70939044a4ff86dc5fc12746a5643bbe5 (diff)
Delete ML-related data of a host in the proper order. (#12672)
Initialization of ML-related structures and threads should happen when the underlying RRD objects have been fully initialized. Destruction should happen in the opposite way, ie. before deleting an RRD host/dimension.
Diffstat (limited to 'ml')
-rw-r--r--ml/ml.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/ml/ml.cc b/ml/ml.cc
index 44e200a236..b56401b07a 100644
--- a/ml/ml.cc
+++ b/ml/ml.cc
@@ -90,7 +90,10 @@ void ml_delete_dimension(RRDDIM *RD) {
return;
Host *H = static_cast<Host *>(RD->rrdset->rrdhost->ml_host);
- H->removeDimension(D);
+ if (!H)
+ delete D;
+ else
+ H->removeDimension(D);
RD->state->ml_dimension = nullptr;
}