pgpool2.git / summary / log / commit / refs
commit 2b55c09cbfb1488ecd0fe0b2d7d5045febea57bd
Author: Muhammad Usama <m.usama@gmail.com>
Date: Thu Jan 29 18:16:39 2015 +0000
Fixing [pgpool-hackers: 772] main process is terminated after
reload when enabeld_pool_hba is on
The problem was with the MemoryContext for pool hba configurations.
Since hba configuration lives as long as child process so must be created
in the TopMemoryContext.
src/auth/pool_hba.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/auth/pool_hba.c b/src/auth/pool_hba.c
index 89e80c77a..17d9c7203 100644
--- a/src/auth/pool_hba.c
+++ b/src/auth/pool_hba.c
@@ -6,9 +6,9 @@
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Portions Copyright (c) 2003-2012 PgPool Global Development Group
+ * Portions Copyright (c) 2003-2015 PgPool Global Development Group
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California *
+ * Portions Copyright (c) 1994, Regents of the University of California
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
* granted, provided that the above copyright notice appear in all
@@ -37,6 +37,7 @@
#include "pool_config.h"
#include "pool_type.h"
#include "utils/palloc.h"
+#include "utils/memutils.h"
#include "utils/elog.h"
#include "parser/pg_list.h"
#include "auth/pool_passwd.h"
@@ -102,10 +103,6 @@ static POOL_CONNECTION *pam_frontend_kludge; /* Workaround for passing
int load_hba(char *hbapath)
{
FILE *file;
-
- if (hba_lines || hba_line_nums)
- free_lines(&hba_lines, &hba_line_nums);
-
file = fopen(hbapath, "r");
if (!file)
{
@@ -120,14 +117,17 @@ int load_hba(char *hbapath)
errdetail("loading file :\"%s\" for client authentication configuration file",
hbapath)));
+ MemoryContext oldContext = MemoryContextSwitchTo(TopMemoryContext);
+
+ if (hba_lines || hba_line_nums)
+ free_lines(&hba_lines, &hba_line_nums);
tokenize_file(hbapath, file, &hba_lines, &hba_line_nums);
fclose(file);
hbaFileName = pstrdup(hbapath);
- /* switch to old memory context */
-
+ MemoryContextSwitchTo(oldContext);
return 0;
}
[parent: 2cfd815f3c92]