summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2023-12-08 10:00:41 +0200
committerTasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com>2023-12-12 17:25:00 +0200
commita1b99f2f088d8ff820745ed765da7f1c8b0ad63d (patch)
tree352512e6bacbd2f279e6c7b95ff06a51f3daf773
parentab1b3eebb33a169e43f352989fa3e6b671bdc302 (diff)
Fix memory leak during host chart label cleanup (#16568)
Fix memory leak (cherry picked from commit 0d3c9beda381fd8a6d5ff4e8f1001bc3e40ae822)
-rw-r--r--database/sqlite/sqlite_metadata.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/database/sqlite/sqlite_metadata.c b/database/sqlite/sqlite_metadata.c
index 0dd5c50d46..76bfe391ea 100644
--- a/database/sqlite/sqlite_metadata.c
+++ b/database/sqlite/sqlite_metadata.c
@@ -1474,12 +1474,11 @@ static void start_metadata_hosts(uv_work_t *req __maybe_unused)
char *machine_guid = *PValue;
host = rrdhost_find_by_guid(machine_guid);
- if (unlikely(host))
- continue;
-
- uuid_t host_uuid;
- if (!uuid_parse(machine_guid, host_uuid))
- delete_host_chart_labels(&host_uuid);
+ if (likely(!host)) {
+ uuid_t host_uuid;
+ if (!uuid_parse(machine_guid, host_uuid))
+ delete_host_chart_labels(&host_uuid);
+ }
freez(machine_guid);
}