Re: PATCH: Memory leaks on start-up - Mailing list pgsql-patches

From Tom Lane
Subject Re: PATCH: Memory leaks on start-up
Date
Msg-id 6239.1058882318@sss.pgh.pa.us
Whole thread Raw
In response to PATCH: Memory leaks on start-up  (Lee Kindness <lkindness@csl.co.uk>)
Responses Re: PATCH: Memory leaks on start-up  (Lee Kindness <lkindness@csl.co.uk>)
List pgsql-patches
Lee Kindness <lkindness@csl.co.uk> writes:
> Guys, attached is a patch to fix two memory leaks on start-up.

I do not like the changes to miscinit.c.  In the first place, it is not
a "memory leak" to do a one-time allocation of state for a proc_exit
function.  A bigger complaint is that your proposed change introduces
fragile coupling between CreateLockFile and its callers, in order to
save no resources worth mentioning.  More, it introduces an assumption
that the globals directoryLockFile and socketLockFile don't change while
the postmaster is running.  UnlinkLockFile should unlink the file that
it was originally told to unlink, regardless of what happens to those
globals.

If you are intent on spending code to free stuff just before the
postmaster exits, a better fix would be for UnlinkLockFile to free its
string argument after using it.

            regards, tom lane

pgsql-patches by date:

Previous
From: Karel Zak
Date:
Subject: Czech NLS
Next
From: Lee Kindness
Date:
Subject: Re: PATCH: Memory leaks on start-up