Fix memory leak when an empty ident file is reloaded.

Hari Babu
This commit is contained in:
Heikki Linnakangas 2013-10-24 14:03:26 +03:00
parent 4d6d425ab8
commit bb598456dc
1 changed files with 4 additions and 2 deletions

View File

@ -2235,7 +2235,7 @@ load_ident(void)
}
/* Loaded new file successfully, replace the one we use */
if (parsed_ident_lines != NULL)
if (parsed_ident_lines != NIL)
{
foreach(parsed_line_cell, parsed_ident_lines)
{
@ -2243,8 +2243,10 @@ load_ident(void)
if (newline->ident_user[0] == '/')
pg_regfree(&newline->re);
}
MemoryContextDelete(parsed_ident_context);
}
if (parsed_ident_context != NULL)
MemoryContextDelete(parsed_ident_context);
parsed_ident_context = ident_context;
parsed_ident_lines = new_parsed_lines;