Windows port minor fixes - Mailing list pgsql-hackers

From Ranier Vilela
Subject Windows port minor fixes
Date
Msg-id CO2PR05MB262934E06BE4C71599508B17E3510@CO2PR05MB2629.namprd05.prod.outlook.com
Whole thread Raw
Responses Re: Windows port minor fixes  (Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>)
List pgsql-hackers
Hi,

According to microsoft documentation at:
https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom
The function CryptGenRandom is deprecated, and may can be removed in future release.
Considering that postgres only supports windows versions that have the new API, it would be good to make the replace.

BCryptGenRandom apparently works without having to set up an environment before calling it, allowing a simplification
inthe file that makes the call. 
The drawback, its change causes need to link to bcrypt.lib.

On exec.c, have two memory leaks, and a possible access beyond heap bounds, the patch tries to fix them.
According to documentation at:
https://en.cppreference.com/w/c/experimental/dynamic/strdup
"The returned pointer must be passed to free to avoid a memory leak. "

* memory leak fix to src/common/exec.c
* CryptGenRandom change by BCryptGenRandom to src/port/pg_strong_random.c
* link bcrypt.lib to src/tools/msvc/Mkvcbuild.pm

regards,
Ranier Vilela
Attachment

pgsql-hackers by date:

Previous
From: Tomas Zubiri
Date:
Subject: Re: Improvement to psql's connection defaults
Next
From: Justin Pryzby
Date:
Subject: ERROR: could not resize shared memory segment...No space left ondevice