Em ter., 21 de jan. de 2020 às 06:18, Juan José Santamaría Flecha <
juanjo.santama...@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

Attachment: postmaster_resource_leak.patch
Description: Binary data

Attachment: win32_shmem_resource_leak.patch
Description: Binary data

Attachment: restricted_token_resource_leak.patch
Description: Binary data

Attachment: regex_resource_leak.patch
Description: Binary data

Attachment: logging_resource_leak.patch
Description: Binary data

Attachment: auth_resource_leak.patch
Description: Binary data

Reply via email to