postgresql/src/backend
Andres Freund bc54ef4ec2 Fix error handling in libpqrcv_connect()
When libpqrcv_connect (also known as walrcv_connect()) failed, it leaked the
libpq connection. In most paths that's fairly harmless, as the calling process
will exit soon after. But e.g. CREATE SUBSCRIPTION could lead to a somewhat
longer lived leak.

Fix by releasing resources, including the libpq connection, on error.

Add a test exercising the error code path. To make it reliable and safe, the
test tries to connect to port=-1, which happens to fail during connection
establishment, rather than during connection string parsing.

Reviewed-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/20230121011237.q52apbvlarfv6jm6@awork3.anarazel.de
Backpatch: 11-
2023-01-23 18:27:42 -08:00
..
access Fix XLogPageRead() comment 2023-01-23 21:46:30 +01:00
backup
bootstrap
catalog Allow REPLICA IDENTITY to be set on an index that's not (yet) valid. 2023-01-21 13:10:29 -05:00
commands Track logrep apply workers' last start times to avoid useless waits. 2023-01-22 14:08:46 -05:00
executor
foreign
jit
lib Fix ILIST_DEBUG build 2023-01-18 10:26:15 -08:00
libpq Support the same patterns for pg-user in pg_ident.conf as in pg_hba.conf 2023-01-20 11:21:55 +09:00
main
nodes Move queryjumble.c code to src/backend/nodes/ 2023-01-21 11:48:37 +09:00
optimizer Allow parallel aggregate on string_agg and array_agg 2023-01-23 17:35:01 +13:00
parser Allow parallel aggregate on string_agg and array_agg 2023-01-23 17:35:01 +13:00
partitioning Update copyright for 2023 2023-01-02 15:00:37 -05:00
po Update copyright for 2023 2023-01-02 15:00:37 -05:00
port
postmaster Reject CancelRequestPacket having unexpected length. 2023-01-21 06:08:00 -08:00
regex
replication Fix error handling in libpqrcv_connect() 2023-01-23 18:27:42 -08:00
rewrite
snowball Update copyright for 2023 2023-01-02 15:00:37 -05:00
statistics
storage Track logrep apply workers' last start times to avoid useless waits. 2023-01-22 14:08:46 -05:00
tcop
tsearch Fix ts_headline() to handle ORs and phrase queries more honestly. 2023-01-19 16:21:44 -05:00
utils Add non-decimal integer support to type numeric. 2023-01-23 19:21:22 +00:00
.gitignore
common.mk
Makefile
meson.build
nls.mk NLS: Put list of available languages into LINGUAS files 2022-07-13 08:19:17 +02:00