]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Initialize all of find.addr in fr_redis_cluster_pool_by_node_addr()
authorJames Jones <jejones3141@gmail.com>
Mon, 29 May 2023 01:14:13 +0000 (20:14 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 29 May 2023 21:00:22 +0000 (16:00 -0500)
Coverity rightly pointed out that only parts of it were set.
Better to initialize it fully than to annotate the defect.

src/lib/redis/cluster.c

index b2127f576e7958885eb2156d9283a8ba6147cda5..07a50cb633343c9fd4ed1603976e36281ebc1ef7 100644 (file)
@@ -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);