@cryptotaxi247 / netdata-1 / commits / a26cd8d8a

Keep rc before freeing it during labels unlink alarms (#13305)

Emmanuel Vasilakis committed Jul 5, 2022 at 16:17 UTC a26cd8d8a87a804075acae487612cc10b3c5173e
1 file changed +8 -2
database/rrdcalc.c
+8 -2
@@ -657,8 +657,13 @@ void rrdcalc_foreach_unlink_and_free(RRDHOST *host, RRDCALC *rc) {
657 }
658
659 static void rrdcalc_labels_unlink_alarm_loop(RRDHOST *host, RRDCALC *alarms) {
660 - for(RRDCALC *rc = alarms ; rc ; rc = rc->next ) {
661 - if (!rc->host_labels) continue;
660 + for(RRDCALC *rc = alarms ; rc ; ) {
661 + RRDCALC *rc_next = rc->next;
662 +
663 + if (!rc->host_labels) {
664 + rc = rc_next;
665 + continue;
666 + }
667
668 if(!rrdlabels_match_simple_pattern_parsed(host->host_labels, rc->host_labels_pattern, '=')) {
669 info("Health configuration for alarm '%s' cannot be applied, because the host %s does not have the label(s) '%s'",
@@ -671,6 +676,7 @@ static void rrdcalc_labels_unlink_alarm_loop(RRDHOST *host, RRDCALC *alarms) {
676 else
677 rrdcalc_foreach_unlink_and_free(host, rc);
678 }
679 + rc = rc_next;
680 }
681 }
682