- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitf0f9ed6
committed
Fix ancient memory leak in contrib/auto_explain.
The ExecutorEnd hook is invoked in a context that could be quitelong-lived, not the executor's own per-query context as I thinkwe were sort of assuming. Thus, any cruft generated while producingthe EXPLAIN output could accumulate over multiple queries. This canresult in spectacular leakage if log_nested_statements is on, andeven without that I'm surprised nobody complained before.To fix, just switch into the executor's context so that anything weallocate will be released when standard_ExecutorEnd frees the executorstate. We might as well nuke the code's retail pfree of the explainoutput string, too; that's laughably inadequate to the need.Japin Li, per report from Jeff Janes. This bug is old, soback-patch to all supported branches.Discussion:https://postgr.es/m/CAMkU=1wCVtbeRn0s9gt12KwQ7PLXovbpM8eg25SYocKW3BT4hg@mail.gmail.com1 parent77a0e14 commitf0f9ed6
1 file changed
+9
-2
lines changedLines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
282 | 282 |
| |
283 | 283 |
| |
284 | 284 |
| |
| 285 | + | |
285 | 286 |
| |
286 | 287 |
| |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
287 | 294 |
| |
288 | 295 |
| |
289 | 296 |
| |
| |||
331 | 338 |
| |
332 | 339 |
| |
333 | 340 |
| |
334 |
| - | |
335 |
| - | |
336 | 341 |
| |
| 342 | + | |
| 343 | + | |
337 | 344 |
| |
338 | 345 |
| |
339 | 346 |
| |
|
0 commit comments
Comments
(0)