Fix segfault in pgpool main process.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 4 Apr 2024 11:44:53 +0000 (20:44 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 4 Apr 2024 11:44:53 +0000 (20:44 +0900)
This is a follow up commit for 0564864e "Fix assorted causes of
segmentation fault.". It lacked the fix while verify_backend_node calls
get_server_version, i.e. checking availability of slots.

Patch provided by: Emond Papegaaij
Backpatch-through: v4.4
Discussion:
[pgpool-general: 9072] Re: Segmentation after switchover
https://www.pgpool.net/pipermail/pgpool-general/2024-April/009133.html

src/main/pgpool_main.c

index ea4c489e52a48ad1a9d484fd5a10594777eaa2ca..786593ca3897e41bd6441b3b39ed3a1994887c96 100644 (file)
@@ -2571,6 +2571,9 @@ verify_backend_node_status(POOL_CONNECTION_POOL_SLOT * *slots)
                        if (!VALID_BACKEND(i))
                                continue;
 
+                       if (!slots[i])
+                               continue;
+
                        if (get_server_version(slots, i) >= 90600)
                        {
                                check_connectivity = true;