From: Sandro Santilli <strk@keybit.net>
To: Greg Stark <stark@mit.edu>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Craig Ringer <craig@2ndquadrant.com>
Cc: Florian Pflug <fgp@phlo.org>
Cc: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Subject: Re: Leaking regexp_replace in 9.3.1 ? (was: [HACKERSUninterruptable regexp_replace in 9.3.1 ?)
Date: Wed, 19 Mar 2014 13:11:02 +0100
Message-ID: <20140319121102.GJ4042@localhost> (raw)
In-Reply-To: <20140319114325.GG4042@localhost>
References: <53077EED.2000907@2ndquadrant.com>
<3663.1393002213@sss.pgh.pa.us>
<646.1393031856@sss.pgh.pa.us>
<20140226150113.GD9740@localhost>
<20140318170401.GE29859@localhost>
<32100.1395186092@sss.pgh.pa.us>
<20140319075359.GA4042@localhost>
<20140319085702.GF4042@localhost>
<CAM-w4HNWVuNqo0d8DUNg5Ucaw6wnx7yzWv6zKnK5RRFN=_rT4Q@mail.gmail.com>
<20140319114325.GG4042@localhost>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On Wed, Mar 19, 2014 at 12:43:25PM +0100, Sandro Santilli wrote:
> On Wed, Mar 19, 2014 at 10:57:10AM +0000, Greg Stark wrote:
> > On Wed, Mar 19, 2014 at 8:57 AM, Sandro Santilli <strk@keybit.net> wrote:
> > > ==21240== by 0x64A200: newdfa.isra.4 (rege_dfa.c:307)
> > > ==21240== by 0x64A4C3: getsubdfa (regexec.c:285)
> > > ==21240== by 0x64B80A: cdissect (regexec.c:673)
> > > ==21240== by 0x64C802: pg_regexec (regexec.c:473)
> >
> >
> > It looks like a simple bug pg_regexec where it's reusing a loop
> > counter "n" to mean two different things. When it goes to free all the
> > subdfas it looks like the code was written based "n" still being the
> > number of trees but in fact it's been reused to be the number of
> > matches.
>
> I confirm this patch fixes the leak:
I've encoded another version of it as a pull request:
https://github.com/postgres/postgres/pull/5
--strk;
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: strk@keybit.net, stark@mit.edu, tgl@sss.pgh.pa.us, craig@2ndquadrant.com, fgp@phlo.org
Subject: Re: Leaking regexp_replace in 9.3.1 ? (was: [HACKERSUninterruptable regexp_replace in 9.3.1 ?)
In-Reply-To: <20140319121102.GJ4042@localhost>
References: <53077EED.2000907@2ndquadrant.com> <3663.1393002213@sss.pgh.pa.us> <646.1393031856@sss.pgh.pa.us> <20140226150113.GD9740@localhost> <20140318170401.GE29859@localhost> <32100.1395186092@sss.pgh.pa.us> <20140319075359.GA4042@localhost> <20140319085702.GF4042@localhost> <CAM-w4HNWVuNqo0d8DUNg5Ucaw6wnx7yzWv6zKnK5RRFN=_rT4Q@mail.gmail.com> <20140319114325.GG4042@localhost> <20140319121102.GJ4042@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox