*** a/src/backend/libpq/hba.c --- b/src/backend/libpq/hba.c *************** *** 2243,2250 **** load_ident(void) if (newline->ident_user[0] == '/') pg_regfree(&newline->re); } - MemoryContextDelete(parsed_ident_context); } parsed_ident_context = ident_context; parsed_ident_lines = new_parsed_lines; --- 2243,2253 ---- if (newline->ident_user[0] == '/') pg_regfree(&newline->re); } } + + if (parsed_ident_context != NULL) + MemoryContextDelete(parsed_ident_context); + parsed_ident_context = ident_context; parsed_ident_lines = new_parsed_lines; *** a/src/backend/utils/misc/guc-file.l --- b/src/backend/utils/misc/guc-file.l *************** *** 120,125 **** ProcessConfigFile(GucContext context) --- 120,127 ---- *head, *tail; int i; + MemoryContext oldcxt; + MemoryContext config_cxt; /* * Config files are processed on startup (by the postmaster only) *************** *** 128,133 **** ProcessConfigFile(GucContext context) --- 130,142 ---- Assert((context == PGC_POSTMASTER && !IsUnderPostmaster) || context == PGC_SIGHUP); + config_cxt = AllocSetContextCreate(TopMemoryContext, + "config parser context", + ALLOCSET_DEFAULT_MINSIZE, + ALLOCSET_DEFAULT_MINSIZE, + ALLOCSET_DEFAULT_MAXSIZE); + oldcxt = MemoryContextSwitchTo(config_cxt); + /* * To avoid cluttering the log, only the postmaster bleats loudly * about problems with the config file. *************** *** 341,346 **** ProcessConfigFile(GucContext context) --- 350,358 ---- cleanup_list: FreeConfigVariables(head); + MemoryContextDelete(config_cxt); + MemoryContextSwitchTo(oldcxt); + if (error) { /* During postmaster startup, any error is fatal */