@cryptotaxi247 / netdata-1 / commits / 36e468847

when destroying pgc, check if the cache is null (#19837)

Costa Tsaousis committed Mar 12, 2025 at 16:16 UTC 36e46884749d9829db26bc77b3cc9c1a69bbad43
2 files changed +4 -1
src/database/engine/cache.c
+3
@@ -2089,6 +2089,9 @@ void pgc_flush_all_hot_and_dirty_pages(PGC *cache, Word_t section) {
2089 }
2090
2091 void pgc_destroy(PGC *cache, bool flush) {
2092 + if(!cache)
2093 + return;
2094 +
2095 if(!flush) {
2096 cache->config.pgc_save_init_cb = NULL;
2097 cache->config.pgc_save_dirty_cb = NULL;
src/database/engine/metric.c
+1 -1
@@ -358,7 +358,7 @@ struct aral_statistics *mrg_aral_stats(void) {
358 }
359
360 size_t mrg_destroy(MRG *mrg) {
361 - if (unlikely(!mrg))
361 + if (!mrg)
362 return 0;
363
364 size_t referenced = 0;