pgsql: Avoid multiple free_struct_lconv() calls on same data. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Avoid multiple free_struct_lconv() calls on same data.
Date
Msg-id E1aaFdf-0001rN-Vx@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Avoid multiple free_struct_lconv() calls on same data.

A failure partway through PGLC_localeconv() led to a situation where
the next call would call free_struct_lconv() a second time, leading
to free() on already-freed strings, typically leading to a core dump.
Add a flag to remember whether we need to do that.

Per report from Thom Brown.  His example case only provokes the failure
as far back as 9.4, but nonetheless this code is obviously broken, so
back-patch to all supported branches.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/907e4dd2b104bdcb4af042065a92fcd73d5790ec

Modified Files
--------------
src/backend/utils/adt/pg_locale.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Avoid multiple free_struct_lconv() calls on same data.
Next
From: Tom Lane
Date:
Subject: pgsql: Avoid multiple free_struct_lconv() calls on same data.