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

Commitd46ad72

Browse files
committed
Create memory context for tokenization after opening top-level file in hba.c
The memory context was created before attempting to open the first HBAor ident file, which would cause it to leak. This had no consequencesfor the system views for HBA and ident files, but this would causememory leaks in the postmaster on reload if the initial HBA and/or identfiles are missing, which is a valid behavior while the backend isrunning.Oversight inefc9816.Author: Ted YuDiscussion:https://postgr.es/m/CALte62xH6ivgiKKzPRJgfekPZC6FKLB3xbnf3=tZmc_gKj78dw@mail.gmail.com
1 parentd5566fb commitd46ad72

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

‎src/backend/libpq/hba.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -601,22 +601,6 @@ open_auth_file(const char *filename, int elevel, int depth,
601601
returnNULL;
602602
}
603603

604-
/*
605-
* When opening the top-level file, create the memory context used for the
606-
* tokenization. This will be closed with this file when coming back to
607-
* this level of cleanup.
608-
*/
609-
if (depth==0)
610-
{
611-
/*
612-
* A context may be present, but assume that it has been eliminated
613-
* already.
614-
*/
615-
tokenize_context=AllocSetContextCreate(CurrentMemoryContext,
616-
"tokenize_context",
617-
ALLOCSET_START_SMALL_SIZES);
618-
}
619-
620604
file=AllocateFile(filename,"r");
621605
if (file==NULL)
622606
{
@@ -634,6 +618,22 @@ open_auth_file(const char *filename, int elevel, int depth,
634618
returnNULL;
635619
}
636620

621+
/*
622+
* When opening the top-level file, create the memory context used for the
623+
* tokenization. This will be closed with this file when coming back to
624+
* this level of cleanup.
625+
*/
626+
if (depth==0)
627+
{
628+
/*
629+
* A context may be present, but assume that it has been eliminated
630+
* already.
631+
*/
632+
tokenize_context=AllocSetContextCreate(CurrentMemoryContext,
633+
"tokenize_context",
634+
ALLOCSET_START_SMALL_SIZES);
635+
}
636+
637637
returnfile;
638638
}
639639

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp