From 557d39be2a575c8a340ead48af2fc6e709d52a00 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 9 Nov 2024 09:26:49 +0100 Subject: Merging upstream version 1.47.5. Signed-off-by: Daniel Baumann --- src/health/health_event_loop.c | 11 +++++++---- src/health/rrdvar.c | 4 ++-- src/health/rrdvar.h | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/health') diff --git a/src/health/health_event_loop.c b/src/health/health_event_loop.c index b50812f2a..04d70e11f 100644 --- a/src/health/health_event_loop.c +++ b/src/health/health_event_loop.c @@ -75,10 +75,13 @@ static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run) time_t needed = now + rc->config.before + rc->config.after; if(needed + update_every < first || needed - update_every > last) { - netdata_log_debug(D_HEALTH - , "Health not examining alarm '%s.%s' yet (not enough data yet - we need %lu but got %lu - %lu)." - , rrdcalc_chart_name(rc), rrdcalc_name(rc), (unsigned long) needed, (unsigned long) first - , (unsigned long) last); + netdata_log_debug(D_HEALTH, + "Health not examining alarm '%s.%s' yet (not enough data yet - we need %lu but got %lu - %lu).", + rrdcalc_chart_name(rc), + rrdcalc_name(rc), + (unsigned long) needed, + (unsigned long) first, + (unsigned long) last); return 0; } } diff --git a/src/health/rrdvar.c b/src/health/rrdvar.c index 4e28e62a3..75cb9739b 100644 --- a/src/health/rrdvar.c +++ b/src/health/rrdvar.c @@ -107,7 +107,7 @@ void rrdvar_host_variable_set(RRDHOST *host, const RRDVAR_ACQUIRED *rva, NETDATA // CUSTOM CHART VARIABLES const RRDVAR_ACQUIRED *rrdvar_chart_variable_add_and_acquire(RRDSET *st, const char *name) { - if(unlikely(!st->rrdvars)) return NULL; + if(unlikely(!st || !st->rrdvars)) return NULL; STRING *name_string = rrdvar_name_to_string(name); const RRDVAR_ACQUIRED *rs = rrdvar_add_and_acquire(st->rrdvars, name_string, NAN); @@ -116,7 +116,7 @@ const RRDVAR_ACQUIRED *rrdvar_chart_variable_add_and_acquire(RRDSET *st, const c } void rrdvar_chart_variable_set(RRDSET *st, const RRDVAR_ACQUIRED *rva, NETDATA_DOUBLE value) { - if(unlikely(!st->rrdvars || !rva)) return; + if(unlikely(!st || !st->rrdvars || !rva)) return; RRDVAR *rv = dictionary_acquired_item_value((const DICTIONARY_ITEM *)rva); if(rv->value != value) { diff --git a/src/health/rrdvar.h b/src/health/rrdvar.h index 31530589d..3297984cb 100644 --- a/src/health/rrdvar.h +++ b/src/health/rrdvar.h @@ -19,7 +19,7 @@ void rrdvar_host_variable_set(RRDHOST *host, const RRDVAR_ACQUIRED *rva, NETDATA int rrdvar_walkthrough_read(DICTIONARY *dict, int (*callback)(const DICTIONARY_ITEM *item, void *rrdvar, void *data), void *data); #define rrdvar_host_variable_release(host, rva) rrdvar_release((host)->rrdvars, rva) -#define rrdvar_chart_variable_release(st, rva) rrdvar_release((st)->rrdvars, rva) +#define rrdvar_chart_variable_release(st, rva) do { if(st) rrdvar_release((st)->rrdvars, rva); } while(0) void rrdvar_release(DICTIONARY *dict, const RRDVAR_ACQUIRED *rva); NETDATA_DOUBLE rrdvar2number(const RRDVAR_ACQUIRED *rva); -- cgit v1.2.3