projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
eeca9dc
)
rrdtool plugin: Check return value of c_avl_get().
author
Florian Forster
<octo@collectd.org>
Fri, 1 Dec 2017 19:45:04 +0000
(20:45 +0100)
committer
Florian Forster
<octo@collectd.org>
Fri, 1 Dec 2017 19:45:04 +0000
(20:45 +0100)
CID: 37940
src/rrdtool.c
patch
|
blob
|
history
diff --git
a/src/rrdtool.c
b/src/rrdtool.c
index
82f570f
..
4fcbad4
100644
(file)
--- a/
src/rrdtool.c
+++ b/
src/rrdtool.c
@@
-627,9
+627,8
@@
static int rrd_cache_insert(const char *filename, const char *value,
return (-1);
}
return (-1);
}
- c_avl_get(cache, filename, (void *)&rc);
-
- if (rc == NULL) {
+ int status = c_avl_get(cache, filename, (void *)&rc);
+ if ((status != 0) || (rc == NULL)) {
rc = malloc(sizeof(*rc));
if (rc == NULL) {
pthread_mutex_unlock(&cache_lock);
rc = malloc(sizeof(*rc));
if (rc == NULL) {
pthread_mutex_unlock(&cache_lock);
@@
-1054,8
+1053,8
@@
static int rrd_init(void) {
random_timeout = 0;
cache_flush_timeout = 0;
} else if (cache_flush_timeout < cache_timeout) {
random_timeout = 0;
cache_flush_timeout = 0;
} else if (cache_flush_timeout < cache_timeout) {
- INFO("rrdtool plugin: \"CacheFlush %.3f\" is less than \"CacheTimeout
%.3f\".
"
- "
A
justing \"CacheFlush\" to %.3f seconds.",
+ INFO("rrdtool plugin: \"CacheFlush %.3f\" is less than \"CacheTimeout "
+ "
%.3f\". Ad
justing \"CacheFlush\" to %.3f seconds.",
CDTIME_T_TO_DOUBLE(cache_flush_timeout),
CDTIME_T_TO_DOUBLE(cache_timeout),
CDTIME_T_TO_DOUBLE(cache_timeout * 10));
CDTIME_T_TO_DOUBLE(cache_flush_timeout),
CDTIME_T_TO_DOUBLE(cache_timeout),
CDTIME_T_TO_DOUBLE(cache_timeout * 10));