@cryptotaxi247 / netdata-1 / commits / db07738fb

fix use after free of streaming current parent (#20305)

Costa Tsaousis committed May 19, 2025 at 18:55 UTC db07738fbbc126d140f8ebde59ccd2464c7d34b2
3 files changed +2 -1
src/database/rrdhost.c
-1
@@ -782,7 +782,6 @@ void rrdhost_free___while_having_rrd_wrlock(RRDHOST *host) {
782 __atomic_sub_fetch(&netdata_buffers_statistics.rrdhost_allocations_size, sizeof(RRDHOST), __ATOMIC_RELAXED);
783
784 freez(host->cache_dir);
785 - rrdhost_stream_parents_free(host, false);
785 simple_pattern_free(host->stream.snd.charts_matching);
786 rrdhost_system_info_free(host->system_info);
787
src/streaming/stream-parents.c
+1
@@ -959,6 +959,7 @@ void rrdhost_stream_parents_free(RRDHOST *host, bool having_write_lock) {
959 }
960
961 host->stream.snd.parents.all = NULL;
962 + host->stream.snd.parents.current = NULL;
963
964 if(!having_write_lock)
965 rw_spinlock_write_unlock(&host->stream.snd.parents.spinlock);
src/streaming/stream-sender-api.c
+1
@@ -92,6 +92,7 @@ void stream_sender_structures_free(struct rrdhost *host) {
92 host->sender = NULL;
93
94 sender_host_buffer_free(host);
95 + rrdhost_stream_parents_free(host, false);
96
97 rrdhost_flag_clear(host, RRDHOST_FLAG_STREAM_SENDER_INITIALIZED);
98 }