pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Plug leak in BuildTupleHashTable by creating ExprContext in corr
Date: Sat, 09 Feb 2019 09:38:51 +0000
Message-ID: <E1gsP63-0004h6-Pm@gemulon.postgresql.org> (raw)

Plug leak in BuildTupleHashTable by creating ExprContext in correct context.

In bf6c614a2f2c5 I added a expr context to evaluate the grouping
expression. Unfortunately the code I added initialized them while in
the calling context, rather the table context.  Additionally, I used
CreateExprContext() rather than CreateStandaloneExprContext(), which
creates the econtext in the estate's query context.

Fix that by using CreateStandaloneExprContext when in the table's
tablecxt. As we rely on the memory being freed by a memory context
reset that means that the econtext's shutdown callbacks aren't being
called, but that seems ok as the expressions are tightly controlled
due to ExecBuildGroupingEqual().

Bug: #15592
Reported-By: Dmitry Marakasov
Author: Andres Freund
Discussion: https://postgr.es/m/20190114222838.h6r3fuyxjxkykf6t@alap3.anarazel.de
Backpatch: 11, where I broke this in bf6c614a2f2c5

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5567d12ce030781a4f749c9cd2034b95a3b64424

Modified Files
--------------
src/backend/executor/execGrouping.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1gsP63-0004h6-Pm@gemulon.postgresql.org>
Permalink:  ../E1gsP63-0004h6-Pm@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gsP63-0004h6-Pm@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 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-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: Plug leak in BuildTupleHashTable by creating ExprContext in corr
  In-Reply-To: <E1gsP63-0004h6-Pm@gemulon.postgresql.org>
  References: <E1gsP63-0004h6-Pm@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