Re: [PATCH] Windows port, fix some resources leaks

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Re: [PATCH] Windows port, fix some resources leaks
Дата
Msg-id CAEudQAqMXQGN--zivLNzF2jZ97P=zf0O93dPL+Ej4fK-Mz=cKQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Windows port, fix some resources leaks  (Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>)
Ответы Re: [PATCH] Windows port, fix some resources leaks
Список pgsql-hackers
Em ter., 21 de jan. de 2020 às 06:18, Juan José Santamaría Flecha <juanjo.santamaria@gmail.com> escreveu:
Some of the code this patch touches is not windows port only, so the subject might be misleading reviewers.
 True. Some leaks occurs at other platforms.
It will be easier to review if you break this patch into smaller and independent committable patches, as one per file.
Done.

I separated the patch, one per file, to facilitate the review according to your suggestion.
It looked like this:
1. /src/backend/postmaster/postmaster.c
In case of failure, it was necessary to deallocate the param pointer and release the handle properly.
2. /src/backend/port/win32_shmem.c
In case of failure, the reserved memory can be released immediately, within the function.
3. /src/common/restricted_token.c
If it is not possible to open the token, better release the dll, we may be the only one to use it.
If it is not possible to allocate the SID, it was necessary to release the handle and release the DLL properly.
The cmdline variable has yet to be released.
4. src / backend / regex / rege_dfa.c
The free_dfa function must free the entire structure, including itself.
5. src / backend / regex / regexec.c
The use of the NOERR () macro, hides the return, which causes the failure to free the memory properly.
6. src / common / logging.c
The strdup function destroys the reference to the old pointer, in case of a loop, it is necessary to release it beforehand.
The free function with variable NULL, has no effect and can be called without problems.
7. /src/backend/libpq/auth.c
In case of failure, it was necessary to release the handlers properly.

regards,
Ranier Vilela
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: SLRU statistics
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: [PATCH] Incremental sort (was: PoC: Partial sort)