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 /aclk | |
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 'aclk')
-rw-r--r-- | aclk/aclk_rx_msgs.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/aclk/aclk_rx_msgs.c b/aclk/aclk_rx_msgs.c index 104fbcb3ec..2d898079b2 100644 --- a/aclk/aclk_rx_msgs.c +++ b/aclk/aclk_rx_msgs.c @@ -272,13 +272,12 @@ int create_node_instance_result(const char *msg, size_t msg_len) .live = 0, .queryable = 1, .session_id = aclk_session_newarch, - .node_id = res.node_id + .node_id = res.node_id, + .capabilities = NULL }; RRDHOST *host = rrdhost_find_by_guid(res.machine_guid); - if (host) { - // not all host must have RRDHOST struct created for them - // if they never connected during runtime of agent + if (likely(host)) { if (host == localhost) { node_state_update.live = 1; node_state_update.hops = 0; @@ -286,10 +285,9 @@ int create_node_instance_result(const char *msg, size_t msg_len) node_state_update.live = (!rrdhost_flag_check(host, RRDHOST_FLAG_ORPHAN)); node_state_update.hops = host->system_info->hops; } + node_state_update.capabilities = aclk_get_node_instance_capas(host); } - node_state_update.capabilities = aclk_get_node_instance_capas(host); - rrdhost_aclk_state_lock(localhost); node_state_update.claim_id = localhost->aclk_state.claimed_id; query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update); |