From: James Jones Date: Mon, 29 May 2023 01:14:13 +0000 (-0500) Subject: Initialize all of find.addr in fr_redis_cluster_pool_by_node_addr() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82eaa1e02e2f8c19aa9748043a5f92407d22644b;p=thirdparty%2Ffreeradius-server.git Initialize all of find.addr in fr_redis_cluster_pool_by_node_addr() Coverity rightly pointed out that only parts of it were set. Better to initialize it fully than to annotate the defect. --- diff --git a/src/lib/redis/cluster.c b/src/lib/redis/cluster.c index b2127f576e7..07a50cb6333 100644 --- a/src/lib/redis/cluster.c +++ b/src/lib/redis/cluster.c @@ -2037,8 +2037,12 @@ int fr_redis_cluster_pool_by_node_addr(fr_pool_t **pool, fr_redis_cluster_t *clu { fr_redis_cluster_node_t find, *found; - find.addr.inet.dst_ipaddr = node_addr->inet.dst_ipaddr; - find.addr.inet.dst_port = node_addr->inet.dst_port; + find.addr = (fr_socket_t) { + .inet = { + .dst_ipaddr = node_addr->inet.dst_ipaddr, + .dst_port = node_addr->inet.dst_port, + } + }; pthread_mutex_lock(&cluster->mutex); found = fr_rb_find(cluster->used_nodes, &find); @@ -2063,7 +2067,6 @@ int fr_redis_cluster_pool_by_node_addr(fr_pool_t **pool, fr_redis_cluster_t *clu pthread_mutex_unlock(&cluster->mutex); return -1; } - /* coverity[uninit_use] */ spare->pending_addr = find.addr; /* Set the config to be applied */ if (cluster_node_connect(cluster, spare) < 0) { pthread_mutex_unlock(&cluster->mutex);