From: Heikki Linnakangas Date: Thu, 24 Oct 2013 11:03:26 +0000 (+0300) Subject: Fix memory leak when an empty ident file is reloaded. X-Git-Tag: REL9_3_2~68 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b0aa17706e210dec4e8d744eac1682e0c6a0a3b0;p=postgresql Fix memory leak when an empty ident file is reloaded. Hari Babu --- 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;