Skip to content

Commit 4f897e3

Browse files
committed
hoist NULL check to before dereference
1 parent 035ce61 commit 4f897e3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/main/realms.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,11 @@ static int server_pool_add(realm_config_t *rc,
16401640
}
16411641
}
16421642

1643+
if (!home) {
1644+
ERROR("Failed to find home server %s", value);
1645+
goto error;
1646+
}
1647+
16431648
if (home->affinity) {
16441649
if (home->virtual_server) {
16451650
ERROR("Home server %s is a virtual server, and cannot be used with 'affinity'", home->name);
@@ -1669,11 +1674,6 @@ static int server_pool_add(realm_config_t *rc,
16691674
pool->affinity_group[home->affinity] = home;
16701675
}
16711676

1672-
if (!home) {
1673-
ERROR("Failed to find home server %s", value);
1674-
goto error;
1675-
}
1676-
16771677
if (do_print) cf_log_info(cs, "\thome_server = %s", home->name);
16781678
pool->servers[num_home_servers++] = home;
16791679
} /* loop over home_server's */

0 commit comments

Comments
 (0)