pgsql: Fix (some of) pltcl memory usage

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix (some of) pltcl memory usage
Date: 2015-07-20 12:25:20
Message-ID: E1ZHA8G-0006ZT-0s@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix (some of) pltcl memory usage

As reported by Bill Parker, PL/Tcl did not validate some malloc() calls
against NULL return. Fix by using palloc() in a new long-lived memory
context instead. This allows us to simplify error handling too, by
simply deleting the memory context instead of doing retail frees.

There's still a lot that could be done to improve PL/Tcl's memory
handling ...

This is pretty ancient, so backpatch all the way back.

Author: Michael Paquier and Álvaro Herrera
Discussion: https://www.postgresql.org/message-id/CAFrbyQwyLDYXfBOhPfoBGqnvuZO_Y90YgqFM11T2jvnxjLFmqw@mail.gmail.com

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/3cb6ef9983b5d7b45e7a5bd42c2cf8714f931850

Modified Files
--------------
src/pl/tcl/pltcl.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2015-07-20 12:55:40 pgsql: Fix (some of) pltcl memory usage
Previous Message Alvaro Herrera 2015-07-20 11:02:22 Re: [COMMITTERS] pgsql: Improve BRIN documentation somewhat