@cryptotaxi247 / netdata-1 / commits / 4c3abc7a4

Add check before releasing metric buffer (#21615)

Make sure curr_gbuf is valid

Stelios Fragkakis committed Jan 23, 2026 at 11:04 UTC 4c3abc7a4355eacbf9f93a3d24f92c3d9f1e57fc
1 file changed +2 -3
src/libnetdata/gorilla/gorilla.cc
+2 -3
@@ -436,14 +436,13 @@ void aral_unmark_allocation(struct aral *ar, void *ptr);
436 void gorilla_writer_aral_unmark(const gorilla_writer_t *gw, struct aral *ar)
437 {
438 const gorilla_buffer_t *curr_gbuf = __atomic_load_n(&gw->head_buffer, __ATOMIC_ACQUIRE);
439 - do {
439 + while (curr_gbuf) {
440 const gorilla_buffer_t *next_gbuf = __atomic_load_n(&curr_gbuf->header.next, __ATOMIC_ACQUIRE);
441
442 - // Call the C function here
442 aral_unmark_allocation(ar, const_cast<void*>(static_cast<const void*>(curr_gbuf)));
443
444 curr_gbuf = next_gbuf;
446 - } while (curr_gbuf);
445 + }
446 }
447
448 /*