Commit 4d2a844
committed
Allow callback functions to deregister themselves during a call.
Fetch the next-item pointer before the call not after, so that
we aren't dereferencing a dangling pointer if the callback
deregistered itself during the call. The risky coding pattern
appears in CallXactCallbacks, CallSubXactCallbacks, and
ResourceOwnerReleaseInternal. (There are some other places that
might be at hazard if they offered deregistration functionality,
but they don't.)
I (tgl) considered back-patching this, but desisted because it
wouldn't be very safe for extensions to rely on this working in
pre-v16 branches.
Hao Wu
Discussion: https://postgr.es/m/CAH+9SWXTiERkmhRke+QCcc+jRH8d5fFHTxh8ZK0-Yn4BSpyaAg@mail.gmail.com1 parent d84a7b2 commit 4d2a844
2 files changed
+18
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3656 | 3656 | | |
3657 | 3657 | | |
3658 | 3658 | | |
| 3659 | + | |
3659 | 3660 | | |
3660 | | - | |
| 3661 | + | |
| 3662 | + | |
| 3663 | + | |
| 3664 | + | |
3661 | 3665 | | |
| 3666 | + | |
3662 | 3667 | | |
3663 | 3668 | | |
3664 | 3669 | | |
| |||
3713 | 3718 | | |
3714 | 3719 | | |
3715 | 3720 | | |
| 3721 | + | |
3716 | 3722 | | |
3717 | | - | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
| 3726 | + | |
3718 | 3727 | | |
| 3728 | + | |
3719 | 3729 | | |
3720 | 3730 | | |
3721 | 3731 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
| 504 | + | |
504 | 505 | | |
505 | 506 | | |
506 | 507 | | |
| |||
701 | 702 | | |
702 | 703 | | |
703 | 704 | | |
704 | | - | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
705 | 709 | | |
| 710 | + | |
706 | 711 | | |
707 | 712 | | |
708 | 713 | | |
| |||
0 commit comments