Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0186ded

Browse files
committed
Fix memory leaks if random salt generation fails.
In the backend, this is just to silence coverity warnings, but in thefrontend, it's a genuine leak, even if extremely rare.Spotted by Coverity, patch by Michael Paquier.
1 parenta54d587 commit0186ded

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

‎src/backend/libpq/auth-scram.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ pg_be_scram_build_verifier(const char *password)
411411
ereport(LOG,
412412
(errcode(ERRCODE_INTERNAL_ERROR),
413413
errmsg("could not generate random salt")));
414+
if (prep_password)
415+
pfree(prep_password);
414416
returnNULL;
415417
}
416418

‎src/interfaces/libpq/fe-auth-scram.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,11 @@ pg_fe_scram_build_verifier(const char *password)
638638

639639
/* Generate a random salt */
640640
if (!pg_frontend_random(saltbuf,SCRAM_DEFAULT_SALT_LEN))
641+
{
642+
if (prep_password)
643+
free(prep_password);
641644
returnNULL;
645+
}
642646

643647
result=scram_build_verifier(saltbuf,SCRAM_DEFAULT_SALT_LEN,
644648
SCRAM_DEFAULT_ITERATIONS,password);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp