forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4b12ab1
committed
Avoid corner-case memory leak in SSL parameter processing.
After reading the root cert list from the ssl_ca_file, immediatelyinstall it as client CA list of the new SSL context. That gives theSSL context ownership of the list, so that SSL_CTX_free will free it.This avoids a permanent memory leak if we fail further down inbe_tls_init(), which could happen if bogus CRL data is offered.The leak could only amount to something if the CRL parameters getbroken after server start (else we'd just quit) and then the serveris SIGHUP'd many times without fixing the CRL data. That's ratherunlikely perhaps, but it seems worth fixing, if only because thecode is clearer this way.While we're here, add some comments about the memory managementaspects of this logic.Noted by Jelte Fennema and independently by Andres Freund.Back-patch to v10; before commitde41869 it doesn't matter,since we'd not re-execute this code during SIGHUP.Discussion:https://postgr.es/m/16160-18367e56e9a28264@postgresql.org1 parent4078ce6 commit4b12ab1
1 file changed
+27
-22
lines changedLines changed: 27 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
84 |
| - | |
85 | 84 |
| |
86 | 85 |
| |
87 | 86 |
| |
| |||
100 | 99 |
| |
101 | 100 |
| |
102 | 101 |
| |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 |
| |
104 | 107 |
| |
105 | 108 |
| |
| |||
272 | 275 |
| |
273 | 276 |
| |
274 | 277 |
| |
| 278 | + | |
| 279 | + | |
275 | 280 |
| |
276 | 281 |
| |
277 | 282 |
| |
| |||
281 | 286 |
| |
282 | 287 |
| |
283 | 288 |
| |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
284 | 308 |
| |
285 | 309 |
| |
286 | 310 |
| |
| |||
297 | 321 |
| |
298 | 322 |
| |
299 | 323 |
| |
300 |
| - | |
| 324 | + | |
301 | 325 |
| |
302 | 326 |
| |
303 | 327 |
| |
| |||
331 | 355 |
| |
332 | 356 |
| |
333 | 357 |
| |
334 |
| - | |
335 |
| - | |
336 |
| - | |
337 |
| - | |
338 |
| - | |
339 |
| - | |
340 |
| - | |
341 |
| - | |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 |
| - | |
349 |
| - | |
350 |
| - | |
351 |
| - | |
352 |
| - | |
353 |
| - | |
354 | 358 |
| |
355 | 359 |
| |
356 | 360 |
| |
| |||
369 | 373 |
| |
370 | 374 |
| |
371 | 375 |
| |
| 376 | + | |
372 | 377 |
| |
373 | 378 |
| |
374 | 379 |
| |
|
0 commit comments
Comments
(0)