Fix (some of) pltcl memory usage

Alvaro Herrera <alvherre@alvh.no-ip.org>

Commit: b0b6f8d71f03463854576b30c1b01e5d772076d8
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2015-07-20T12:18:08Z
Releases: 9.5.0
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

Files

PathChange+/−
src/pl/tcl/pltcl.c modified +18 −9

Discussion