From: Iain Buclaw Date: Fri, 19 May 2017 10:55:37 +0000 (+0200) Subject: format_graphite: Error if call to uc_get_rate fails to return a value. X-Git-Tag: collectd-5.7.2~2^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=58ef5973f118ceff1e09d59414c438242091adab;p=collectd.git format_graphite: Error if call to uc_get_rate fails to return a value. This prevents a wrong value being sent to graphite for DERIVE types. See #2209 Signed-off-by: Florian Forster --- diff --git a/src/utils_format_graphite.c b/src/utils_format_graphite.c index 2fe93959..40bfff51 100644 --- a/src/utils_format_graphite.c +++ b/src/utils_format_graphite.c @@ -165,8 +165,13 @@ int format_graphite(char *buffer, size_t buffer_size, data_set_t const *ds, int buffer_pos = 0; gauge_t *rates = NULL; - if (flags & GRAPHITE_STORE_RATES) + if (flags & GRAPHITE_STORE_RATES) { rates = uc_get_rate(ds, vl); + if (rates == NULL) { + ERROR("format_graphite: error with uc_get_rate"); + return -1; + } + } for (size_t i = 0; i < ds->ds_num; i++) { char const *ds_name = NULL;