X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Frrdtool.c;h=e093f2b27f5395c7ec304044d84fc305af6e0fef;hb=ef07224d5a3e24ccbc71765194d91a8e00ce16fc;hp=bebf468c3c83ce8158a082207c7c950382bf0352;hpb=30eeeee996124de666f907877f8196e5580101ed;p=collectd.git diff --git a/src/rrdtool.c b/src/rrdtool.c index bebf468c..e093f2b2 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -204,7 +204,7 @@ static int value_list_to_string_multiple (char *buffer, int buffer_len, int offset; int status; time_t tt; - int i; + size_t i; memset (buffer, '\0', buffer_len); @@ -733,7 +733,10 @@ static int rrd_cache_insert (const char *filename, { rc = malloc (sizeof (*rc)); if (rc == NULL) + { + pthread_mutex_unlock (&cache_lock); return (-1); + } rc->values_num = 0; rc->values = NULL; rc->first_value = 0; @@ -743,6 +746,7 @@ static int rrd_cache_insert (const char *filename, new_rc = 1; } + assert (value_time > 0); /* plugin_dispatch() ensures this. */ if (rc->last_value >= value_time) { pthread_mutex_unlock (&cache_lock);