mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Fix memory leaks if random salt generation fails.
In the backend, this is just to silence coverity warnings, but in the frontend, it's a genuine leak, even if extremely rare. Spotted by Coverity, patch by Michael Paquier.
This commit is contained in:
@ -638,7 +638,11 @@ pg_fe_scram_build_verifier(const char *password)
|
||||
|
||||
/* Generate a random salt */
|
||||
if (!pg_frontend_random(saltbuf, SCRAM_DEFAULT_SALT_LEN))
|
||||
{
|
||||
if (prep_password)
|
||||
free(prep_password);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = scram_build_verifier(saltbuf, SCRAM_DEFAULT_SALT_LEN,
|
||||
SCRAM_DEFAULT_ITERATIONS, password);
|
||||
|
Reference in New Issue
Block a user