summaryrefslogtreecommitdiffstats
path: root/ml/ml.cc
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2023-08-17 23:59:14 +0300
committerGitHub <noreply@github.com>2023-08-17 23:59:14 +0300
commit1dc121a12d8d6a43f051d501e3f4edd1bbc588cf (patch)
treeb207a04855018d6b24e0dfcde45d86e1f928531f /ml/ml.cc
parent48afde0b201c31dd1aa71a222a999fc6d70870af (diff)
Fix use after free (#15825)
Diffstat (limited to 'ml/ml.cc')
-rw-r--r--ml/ml.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/ml/ml.cc b/ml/ml.cc
index df131324af..212f437d22 100644
--- a/ml/ml.cc
+++ b/ml/ml.cc
@@ -1726,6 +1726,9 @@ void ml_stop_threads()
Cfg.detection_stop = true;
Cfg.training_stop = true;
+ if (!Cfg.detection_thread)
+ return;
+
netdata_thread_cancel(Cfg.detection_thread);
netdata_thread_join(Cfg.detection_thread, NULL);