forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit92fc127
committed
Fix error handling in libpqrcv_connect()
When libpqrcv_connect (also known as walrcv_connect()) failed, it leaked thelibpq connection. In most paths that's fairly harmless, as the calling processwill exit soon after. But e.g. CREATE SUBSCRIPTION could lead to a somewhatlonger 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, thetest tries to connect to port=-1, which happens to fail during connectionestablishment, rather than during connection string parsing.Reviewed-by: Noah Misch <noah@leadboat.com>Discussion:https://postgr.es/m/20230121011237.q52apbvlarfv6jm6@awork3.anarazel.deBackpatch: 11-1 parenta5f3f2f commit92fc127
File tree
3 files changed
+32
-13
lines changed- src
- backend/replication/libpqwalreceiver
- test/regress
- expected
- sql
3 files changed
+32
-13
lines changedLines changed: 15 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
162 | 162 |
| |
163 | 163 |
| |
164 | 164 |
| |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 |
| - | |
| 165 | + | |
169 | 166 |
| |
170 | 167 |
| |
171 | 168 |
| |
| |||
207 | 204 |
| |
208 | 205 |
| |
209 | 206 |
| |
210 |
| - | |
211 |
| - | |
212 |
| - | |
213 |
| - | |
| 207 | + | |
214 | 208 |
| |
215 | 209 |
| |
216 | 210 |
| |
| |||
221 | 215 |
| |
222 | 216 |
| |
223 | 217 |
| |
224 |
| - | |
225 |
| - | |
226 |
| - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
227 | 221 |
| |
228 | 222 |
| |
229 | 223 |
| |
230 | 224 |
| |
231 | 225 |
| |
232 | 226 |
| |
233 | 227 |
| |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
234 | 238 |
| |
235 | 239 |
| |
236 | 240 |
| |
|
Lines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
74 |
| - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
75 | 83 |
| |
76 | 84 |
| |
77 | 85 |
| |
|
Lines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
59 |
| - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
60 | 67 |
| |
61 | 68 |
| |
62 | 69 |
| |
|
0 commit comments
Comments
(0)