Commit bb598456 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Fix memory leak when an empty ident file is reloaded.

Hari Babu
parent 4d6d425a
...@@ -2235,7 +2235,7 @@ load_ident(void) ...@@ -2235,7 +2235,7 @@ load_ident(void)
} }
/* Loaded new file successfully, replace the one we use */ /* 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) foreach(parsed_line_cell, parsed_ident_lines)
{ {
...@@ -2243,8 +2243,10 @@ load_ident(void) ...@@ -2243,8 +2243,10 @@ load_ident(void)
if (newline->ident_user[0] == '/') if (newline->ident_user[0] == '/')
pg_regfree(&newline->re); pg_regfree(&newline->re);
} }
MemoryContextDelete(parsed_ident_context);
} }
if (parsed_ident_context != NULL)
MemoryContextDelete(parsed_ident_context);
parsed_ident_context = ident_context; parsed_ident_context = ident_context;
parsed_ident_lines = new_parsed_lines; parsed_ident_lines = new_parsed_lines;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment