Re: Improve OOM handling in pg_locale.c - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Improve OOM handling in pg_locale.c
Date
Msg-id CAB7nPqSdivXv2Vt_8C8Gz8=7fDBvFQtEw_1uyXsJSafnik4Jyw@mail.gmail.com
Whole thread Raw
In response to Improve OOM handling in pg_locale.c  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On Tue, Nov 22, 2016 at 8:28 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I could have lived with leaving the leak there, but really this wasn't
> fixing the worst problem with the code: if it did throw an error out of
> the middle of that sequence, it would leave the process setlocale'd to
> some other locale than we want.  That could lead to unwanted behavior
> in printf and other functions.  And this isn't all that unlikely: an
> encoding conversion failure is definitely possible if you have a locale
> selected that's not compatible with the database encoding.
>
> I whacked the patch around enough so that we didn't do anything except
> libc calls between setting and restoring the locale.  At that point it
> was just a matter of adding a TRY block to be able to say that we
> didn't leak any strdup'd strings, so I figured "might as well".
>
> Pushed with those changes.

Thanks. The changes you have done look good to me at short sight.
-- 
Michael



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [sqlsmith] Parallel worker crash on seqscan
Next
From: Tom Lane
Date:
Subject: Re: Improve OOM handling in pg_locale.c