pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Bill Parker <wp02855@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: Lack of Sanity Checking in file 'pctcl.c' for PostgreSQL 9.4.x
Date: Fri, 12 Jun 2015 16:47:17 -0300
Message-ID: <20150612194716.GQ133018@postgresql.org> (raw)
In-Reply-To: <CAB7nPqRmXz2DymNd_BX8HkaRJuQCTUyhh2d5Zx+d0aHNvpTw0Q@mail.gmail.com>
References: <CAFrbyQwyLDYXfBOhPfoBGqnvuZO_Y90YgqFM11T2jvnxjLFmqw@mail.gmail.com>
	<CAB7nPqRmXz2DymNd_BX8HkaRJuQCTUyhh2d5Zx+d0aHNvpTw0Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Michael Paquier wrote:
> On Fri, Jun 12, 2015 at 4:22 AM, Bill Parker wrote:
> >    In reviewing some code, in directory 'postgresql-9.4.3/src/pl/tcl',
> > file 'pltcl.c', there are several instances where calls to malloc()
> > are made, but no check for a return value of NULL is made, which
> > would indicate failure.   Additionally, it appears when malloc()
> > returns NULL, previously allocated memory in function 'perm_fmgr_info'
> > is not released, which could lead to memory leaks (even though the
> > comment at the top says 'this routine is a crock' :)
> >
> > If you know how this problem might be fixed, list the solution below:
> > Please feel free to review and comment on the above patch file...
> 
> Oh, nice catch again.
> 
> > I am attaching the patch file to this bug report
> 
> By the way, your patch does not compile properly and is not in-line
> with the project's code format. See the updated patch attached ;)

... or the conventions for allocating memory.  Why not just use palloc()?


-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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



view thread (11+ messages)  latest in thread

Message-ID: <20150612194716.GQ133018@postgresql.org>
Permalink:  ../20150612194716.GQ133018@postgresql.org/
Also on:    postgresql.org/message-id/20150612194716.GQ133018@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-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, michael.paquier@gmail.com, wp02855@gmail.com
  Subject: Re: Lack of Sanity Checking in file 'pctcl.c' for PostgreSQL 9.4.x
  In-Reply-To: <20150612194716.GQ133018@postgresql.org>
  References: <CAFrbyQwyLDYXfBOhPfoBGqnvuZO_Y90YgqFM11T2jvnxjLFmqw@mail.gmail.com> <CAB7nPqRmXz2DymNd_BX8HkaRJuQCTUyhh2d5Zx+d0aHNvpTw0Q@mail.gmail.com> <20150612194716.GQ133018@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