1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Fix two thinkos related to strong random keys.

pg_backend_random() is used for MD5 salt generation, but it can fail, and
no checks were done on its status code.

Fix memory leak, if generating a random number for a cancel key failed.

Both issues were spotted by Coverity. Fix by Michael Paquier.
This commit is contained in:
Heikki Linnakangas
2016-12-12 09:58:32 +02:00
parent ad365b2f91
commit 41493bac36
2 changed files with 7 additions and 1 deletions

View File

@@ -3901,6 +3901,7 @@ BackendStartup(Port *port)
*/
if (!RandomCancelKey(&MyCancelKey))
{
free(bn);
ereport(LOG,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("could not acquire random number")));