]> granicus.if.org Git - postgresql/commitdiff
Fix memory leak when an empty ident file is reloaded.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 24 Oct 2013 11:03:26 +0000 (14:03 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 24 Oct 2013 11:05:34 +0000 (14:05 +0300)
Hari Babu

src/backend/libpq/hba.c

index 91f6ced0d2f526836b15fa3bcb877a920f2f813c..1c75acc94b6eafbc96d9279c19eb188ccae4d43b 100644 (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;