pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix low-probability memory leak in regex execution.
Date: Fri, 18 Sep 2015 17:55:44 +0000
Message-ID: <E1Zczsu-0005N7-Mn@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix low-probability memory leak in regex execution.

After an internal failure in shortest() or longest() while pinning down the
exact location of a match, find() forgot to free the DFA structure before
returning.  This is pretty unlikely to occur, since we just successfully
ran the "search" variant of the DFA; but it could happen, and it would
result in a session-lifespan memory leak since this code uses malloc()
directly.  Problem seems to have been aboriginal in Spencer's library,
so back-patch all the way.

In passing, correct a thinko in a comment I added awhile back about the
meaning of the "ntree" field.

I happened across these issues while comparing our code to Tcl's version
of the library.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f7d896ab919af6ef74117c6121443721902beba3

Modified Files
--------------
src/backend/regex/regcomp.c |    2 +-
src/backend/regex/regexec.c |    6 +++++-
src/include/regex/regguts.h |    2 +-
3 files changed, 7 insertions(+), 3 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (11+ messages)  latest in thread

Message-ID: <E1Zczsu-0005N7-Mn@gemulon.postgresql.org>
Permalink:  ../E1Zczsu-0005N7-Mn@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1Zczsu-0005N7-Mn@gemulon.postgresql.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix low-probability memory leak in regex execution.
  In-Reply-To: <E1Zczsu-0005N7-Mn@gemulon.postgresql.org>

* 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