From 75ecb70175a778a8a389307b0048cf8fd53c5064 Mon Sep 17 00:00:00 2001 From: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:32:06 +0300 Subject: Fix coverity issues (#15345) * sensor_name always has a value -- CID 395493: Control flow issues (DEADCODE) * Check fopen failure -- CID 395492: Null pointer dereferences (NULL_RETURNS) * CID 395491: Control flow issues (DEADCODE) * sel_count will be >=0 in this case -- CID 395490: Control flow issues (DEADCODE) * Memory leak -- CID 395487: Resource leaks (RESOURCE_LEAK) --- web/api/web_api_v2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'web') diff --git a/web/api/web_api_v2.c b/web/api/web_api_v2.c index c4727f75d9..29bbb10bbf 100644 --- a/web/api/web_api_v2.c +++ b/web/api/web_api_v2.c @@ -103,11 +103,11 @@ static bool verify_agent_uuids(const char *machine_guid, const char *node_id, co return false; char *agent_claim_id = get_agent_claimid(); - if(!agent_claim_id || strcmp(claim_id, agent_claim_id) != 0) - return false; + + bool not_verified = (!agent_claim_id || strcmp(claim_id, agent_claim_id) != 0); freez(agent_claim_id); - if(!localhost->node_id) + if(not_verified || !localhost->node_id) return false; char buf[UUID_STR_LEN]; -- cgit v1.2.3