From: Sebastian Harl Date: Sat, 23 Dec 2006 13:01:14 +0000 (+0100) Subject: sensors plugin: Avoid assertion in ignorelist_match () when not configured. X-Git-Tag: collectd-3.11.0~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4285addef1e67f3d4c4b01ca3cbe5b7a2cae4d89;p=collectd.git sensors plugin: Avoid assertion in ignorelist_match () when not configured. If the sensors plugin is not configured (i.e. default settings are used) the ignorelist (sensors_list) is never created causing the assertion in ignorelist_match () to fail. This fixes it. Signed-off-by: Sebastian Harl --- diff --git a/src/sensors.c b/src/sensors.c index d15569c0..66cd5b22 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -393,7 +393,8 @@ static void sensors_shutdown (void) sensors_free_features (); #endif /* if SENSORS_HAVE_READ */ - ignorelist_free (sensor_list); + if (NULL != sensor_list) + ignorelist_free (sensor_list); } static void sensors_voltage_write (char *host, char *inst, char *val) @@ -402,7 +403,7 @@ static void sensors_voltage_write (char *host, char *inst, char *val) int status; /* skip ignored in our config */ - if (ignorelist_match (sensor_list, inst)) + if ((NULL != sensor_list) && ignorelist_match (sensor_list, inst)) return; /* extended sensor naming */ @@ -423,7 +424,7 @@ static void sensors_write (char *host, char *inst, char *val) int status; /* skip ignored in our config */ - if (ignorelist_match (sensor_list, inst)) + if ((NULL != sensor_list) && ignorelist_match (sensor_list, inst)) return; /* extended sensor naming */ @@ -450,7 +451,7 @@ static void sensors_submit (const char *feat_name, return; /* skip ignored in our config */ - if (ignorelist_match (sensor_list, inst)) + if ((NULL != sensor_list) && ignorelist_match (sensor_list, inst)) return; if (snprintf (buf, BUFSIZE, "%u:%.3f", (unsigned int) curtime,