Re: [PATCH] Memory leak, at src/common/exec.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ranier Vilela <ranier_gyn(at)hotmail(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Memory leak, at src/common/exec.c
Date: 2019-12-16 23:09:31
Message-ID: 29478.1576537771@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ranier Vilela <ranier_gyn(at)hotmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2019-12-16 23:17:08 Re: ERROR: could not resize shared memory segment...No space left on device
Previous Message Ranier Vilela 2019-12-16 22:44:21 RE: [PATCH] Memory leak, at src/common/exec.c