Re: Problem with setlocale (found in libecpg) [accessing a memory location after freeing it]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Christof Petig <christof(at)petig-baender(dot)de>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Problem with setlocale (found in libecpg) [accessing a memory location after freeing it]
Date: 2001-09-29 20:15:01
Message-ID: 13272.1001794501@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Michael Meskes <meskes(at)postgresql(dot)org> writes:
> You're partially right. Standard says "This string may be allocated in
> static storage." So, yes, with your patch we are on the safe side. I just
> committed the changes.

This patch wasn't right: setlocale(LC_NUMERIC, "C") returns a string
corresponding to the *new* locale setting, not the old one. Therefore,
while the patched code failed to dump core, it also failed to restore
the previous locale setting as intended. I have committed an updated
version.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ken Hirsch 2001-09-29 20:28:00 Re: Pre-forking backend
Previous Message Vince Vielhaber 2001-09-29 20:14:25 Re: Preparation for Beta

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2001-09-29 22:53:54 Re: More fixes for missing double quotes in the shell
Previous Message Bruce Momjian 2001-09-29 18:26:03 Re: regression tests for pgcrypto