Обсуждение: pgsql: Fix WaitEventSet resource leak in WaitLatchOrSocket().

Поиск
Список
Период
Сортировка

pgsql: Fix WaitEventSet resource leak in WaitLatchOrSocket().

От
Etsuro Fujita
Дата:
Fix WaitEventSet resource leak in WaitLatchOrSocket().

This function would have the same issue we solved in commit 501cfd07d:
If an error is thrown after calling CreateWaitEventSet(), the file
descriptor (on epoll- or kqueue-based systems) or handles (on Windows)
that the WaitEventSet contains are leaked.

Like that commit, use PG_TRY-PG_FINALLY (PG_TRY-PG_CATCH in v12) to make
sure the WaitEventSet is freed properly.

Back-patch to all supported versions, but as we do not have this issue
in HEAD (cf. commit 50c67c201), no need to apply this patch to it.

Discussion: https://postgr.es/m/CAPmGK16MqdDoD8oatp8SQWaEa4vS3nfQqDN_Sj9YRuu5J3Lj9g%40mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0341d4b10e786dcbc4c63da9d21af842ab31e118

Modified Files
--------------
src/backend/storage/ipc/latch.c | 69 +++++++++++++++++++++++------------------
1 file changed, 39 insertions(+), 30 deletions(-)