Fix coverity issues (#20612)
* Release uuid list (CID 471887) Fix issues 465323, 466650, 466648, 465322 * Fix issue 410077
Stelios Fragkakis committed
Jul 2, 2025 at 18:02 UTC
d18bae8c8ff604ac6f43ef271c76e3b7d73adddc
3 files changed
+19
-4
src/daemon/libuv_workers.c
+2
-2
@@ -167,8 +167,8 @@ void init_cmd_pool(CmdPool *pool, int size) {
167
pool->tail = 0;
168
pool->count = 0;
169
170
- uv_mutex_init(&pool->lock);
171
- uv_cond_init(&pool->not_full);
170
+ fatal_assert(0 == uv_mutex_init(&pool->lock));
171
+ fatal_assert(0 == uv_cond_init(&pool->not_full));
172
}
173
174
bool push_cmd(CmdPool *pool, const cmd_data_t *cmd, bool wait_on_full)
src/database/engine/rrdengine.c
+2
-1
@@ -617,6 +617,7 @@ static void journalfile_extent_build(struct rrdengine_instance *ctx, struct exte
617
618
df_header = xt_io_descr->buf;
619
count = df_header->number_of_pages;
620
+ fatal_assert(count <= MAX_PAGES_PER_EXTENT);
621
descr_size = sizeof(*jf_metric_data->descr) * count;
622
payload_length = sizeof(*jf_metric_data) + descr_size;
623
size_bytes = sizeof(*jf_header) + payload_length + sizeof(*jf_trailer);
@@ -1572,7 +1573,7 @@ static void *populate_mrg_tp_worker(
1573
&mlt[thread_index]);
1574
1575
if (!mlt[thread_index].thread) {
1575
- nd_log_daemon(NDLP_WARNING, "Failed to create thread, rc = %d", rc);
1576
+ nd_log_daemon(NDLP_WARNING, "Failed to create thread for MRG population");
1577
__atomic_store_n(&mlt[thread_index].busy, false, __ATOMIC_RELEASE);
1578
spinlock_unlock(&datafile->populate_mrg.spinlock);
1579
}
src/database/sqlite/sqlite_metadata.c
+15
-1
@@ -1918,7 +1918,6 @@ static void ctx_hosts_load(uv_work_t *req)
1918
if (hclt[index].db_context_thread)
1919
sqlite3_close_v2(hclt[index].db_context_thread);
1920
}
1921
- freez(hclt);
1921
}
1922
1923
usec_t ended_ut = now_monotonic_usec(); (void)ended_ut;
@@ -1940,6 +1939,7 @@ static void ctx_hosts_load(uv_work_t *req)
1939
db_meta_thread = NULL;
1940
db_context_thread = NULL;
1941
}
1942
+ freez(hclt);
1943
worker_is_idle();
1944
}
1945
@@ -2694,6 +2694,20 @@ static void *metadata_event_loop(void *arg)
2694
freez(pending_ctx_cleanup_list);
2695
}
2696
2697
+ if (pending_uuid_deletion) {
2698
+ Word_t Index = 0;
2699
+ bool first = true;
2700
+ Pvoid_t *Pvalue;
2701
+ while ((Pvalue = JudyLFirstThenNext(pending_uuid_deletion->JudyL, &Index, &first))) {
2702
+ if (!*Pvalue)
2703
+ continue;
2704
+ nd_uuid_t *uuid = *Pvalue;
2705
+ freez(uuid);
2706
+ }
2707
+ (void)JudyLFreeArray(&pending_uuid_deletion->JudyL, PJE0);
2708
+ freez(pending_uuid_deletion);
2709
+ }
2710
+
2711
buffer_free(work_buffer);
2712
release_cmd_pool(&config->cmd_pool);
2713
worker_unregister();