diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2023-02-21 09:53:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-21 09:53:03 +0200 |
commit | bde40023ed79c9f6ee42dbd85ab92b2ba2e1fa70 (patch) | |
tree | df56666b50e9559e596d86e639bce59041ccc888 /database | |
parent | f1f6f4e197658c7f038966b6d6272366ca52ee80 (diff) |
Fix coverity issues (#14543)
* Fix coverity 383236: Resource leak
* Fix coverity 382915 : Logically dead code
* Fix coverity 379133 : Division or modulo by float zero
* Fix coverity 382783 : Copy into fixed size buffer
* Fix coverity 381151 : Missing unlock
* Fix coverity 381903 : Dereference after null check
Diffstat (limited to 'database')
-rw-r--r-- | database/engine/cache.c | 2 | ||||
-rw-r--r-- | database/rrdcalc.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/database/engine/cache.c b/database/engine/cache.c index 7326a8c9aa..e8c8a21b52 100644 --- a/database/engine/cache.c +++ b/database/engine/cache.c @@ -1764,7 +1764,7 @@ PGC *pgc_create(const char *name, cache->config.max_dirty_pages_per_call = max_dirty_pages_per_flush; cache->config.pgc_save_init_cb = pgc_save_init_cb; cache->config.pgc_save_dirty_cb = pgc_save_dirty_cb; - cache->config.max_pages_per_inline_eviction = (max_pages_per_inline_eviction < 2) ? 2 : max_pages_per_inline_eviction; + cache->config.max_pages_per_inline_eviction = max_pages_per_inline_eviction; cache->config.max_skip_pages_per_inline_eviction = (max_skip_pages_per_inline_eviction < 2) ? 2 : max_skip_pages_per_inline_eviction; cache->config.max_flushes_inline = (max_flushes_inline < 1) ? 1 : max_flushes_inline; cache->config.partitions = partitions < 1 ? (size_t)get_netdata_cpus() : partitions; diff --git a/database/rrdcalc.c b/database/rrdcalc.c index e25a22805a..3063ad0f2b 100644 --- a/database/rrdcalc.c +++ b/database/rrdcalc.c @@ -95,7 +95,7 @@ static STRING *rrdcalc_replace_variables_with_rrdset_labels(const char *line, RR temp = buf; } else if (!strncmp(var, RRDCALC_VAR_LABEL, RRDCALC_VAR_LABEL_LEN)) { - char label_val[RRDCALC_VAR_MAX + 1] = { 0 }; + char label_val[RRDCALC_VAR_MAX + RRDCALC_VAR_LABEL_LEN + 1] = { 0 }; strcpy(label_val, var+RRDCALC_VAR_LABEL_LEN); label_val[i - RRDCALC_VAR_LABEL_LEN - 1] = '\0'; |