summaryrefslogtreecommitdiffstats
path: root/database
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 /database
parent48afde0b201c31dd1aa71a222a999fc6d70870af (diff)
Fix use after free (#15825)
Diffstat (limited to 'database')
-rw-r--r--database/rrdhost.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/database/rrdhost.c b/database/rrdhost.c
index 33ff0aae8c..c8a6e55d98 100644
--- a/database/rrdhost.c
+++ b/database/rrdhost.c
@@ -509,7 +509,8 @@ int is_legacy = 1;
if(t != host) {
netdata_log_error("Host '%s': cannot add host with machine guid '%s' to index. It already exists as host '%s' with machine guid '%s'.",
rrdhost_hostname(host), host->machine_guid, rrdhost_hostname(t), t->machine_guid);
- rrdhost_free___while_having_rrd_wrlock(host, true);
+ if (!is_localhost)
+ rrdhost_free___while_having_rrd_wrlock(host, true);
rrd_unlock();
return NULL;
}