Re: [PATCH] Memory leak, at src/common/exec.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Memory leak, at src/common/exec.c
Date
Msg-id 29478.1576537771@sss.pgh.pa.us
Whole thread Raw
In response to RE: [PATCH] Memory leak, at src/common/exec.c  (Ranier Vilela <ranier_gyn@hotmail.com>)
List pgsql-hackers
Ranier Vilela <ranier_gyn@hotmail.com> writes:
> According to the documentation at:
>
https://wiki.sei.cmu.edu/confluence/display/c/POS34-C.+Do+not+call+putenv%28%29+with+a+pointer+to+an+automatic+variable+as+the+argument
> "Using setenv() is easier and consequently less error prone than using putenv()."
> putenv is problematic and error prone, better replace by setenv.

setenv is also less portable: it does not appear in SUSv2, which is still
our baseline spec for Unix platforms.  We've avoided its use since 2001,
cf. ec7ddc158.

It's also fair to wonder how well this change would fly on Windows,
where we have to implement putenv for ourselves to get things to work
right (cf. src/port/win32env.c, which does not offer support for
setenv).

Please stop inventing reasons to change code that's worked fine for
decades.  We have better things to spend our time on.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: RE: [PATCH] Memory leak, at src/common/exec.c
Next
From: Thomas Munro
Date:
Subject: Re: ERROR: could not resize shared memory segment...No space left on device