forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0a796b8
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 parent0765b2f commit0a796b8
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 | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 167 | + | |
171 | 168 | | |
172 | 169 | | |
173 | 170 | | |
| |||
209 | 206 | | |
210 | 207 | | |
211 | 208 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 209 | + | |
216 | 210 | | |
217 | 211 | | |
218 | 212 | | |
| |||
223 | 217 | | |
224 | 218 | | |
225 | 219 | | |
226 | | - | |
227 | | - | |
228 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
229 | 223 | | |
230 | 224 | | |
231 | 225 | | |
232 | 226 | | |
233 | 227 | | |
234 | 228 | | |
235 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
236 | 240 | | |
237 | 241 | | |
238 | 242 | | |
| |||
| 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 | | |
| |||
| 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)