summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas2013-10-24 11:03:26 +0000
committerHeikki Linnakangas2013-10-24 11:03:26 +0000
commitbb598456dcdad5080f6dee980bc5cc94d2e9f574 (patch)
tree6280cd939da16a6cb10a437db158fec5a5c2ad8a /src
parent4d6d425ab8d9b00c097d8bb8ce85302ea62887a3 (diff)
Fix memory leak when an empty ident file is reloaded.
Hari Babu
Diffstat (limited to 'src')
-rw-r--r--src/backend/libpq/hba.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 91f6ced0d2..1c75acc94b 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -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;