Re: BUG #1258: backend memory leak after massive 'CREATE/DROP USER' - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1258: backend memory leak after massive 'CREATE/DROP USER'
Date
Msg-id 27731.1095470693@sss.pgh.pa.us
Whole thread Raw
In response to BUG #1258: backend memory leak after massive 'CREATE/DROP USER'  ("PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>)
List pgsql-bugs
"PostgreSQL Bugs List" <pgsql-bugs@postgresql.org> writes:
> Description:        backend memory leak after massive 'CREATE/DROP USER'

Actually postmaster memory leak, but good catch anyway --- thanks!
The patch against 7.4 is

Index: hba.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/libpq/hba.c,v
retrieving revision 1.116.2.2
diff -c -r1.116.2.2 hba.c
*** hba.c    25 May 2004 19:11:26 -0000    1.116.2.2
--- hba.c    18 Sep 2004 01:16:18 -0000
***************
*** 168,173 ****
--- 168,176 ----
   *     Tokenize file and handle file inclusion and comma lists. We have
   *     to  break    apart  the    commas    to    expand    any  file names then
   *     reconstruct with commas.
+  *
+  * The result is always a palloc'd string.  If it's zero-length then
+  * we have reached EOL.
   */
  static char *
  next_token_expand(FILE *file)
***************
*** 333,338 ****
--- 336,343 ----
          {
              /* we are at real or logical EOL, so force a new line List */
              next_line = NIL;
+             /* Don't forget to pfree the next_token_expand result */
+             pfree(buf);
          }

          /* Advance line number whenever we reach EOL */


            regards, tom lane

pgsql-bugs by date:

Previous
From: "John R Pierce"
Date:
Subject: Re: BUG #1258: backend memory leak after massive 'CREATE/DROP USER'
Next
From: "Conal Tuohy"
Date:
Subject: Error starting service on Win2k