Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3WK6-00052P-VD for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Jun 2015 21:17:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z3WK6-00081s-GD for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Jun 2015 21:17:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z3WK5-00081k-Sp for pgsql-bugs@postgresql.org; Fri, 12 Jun 2015 21:17:09 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z3WJy-0008PH-6Y for pgsql-bugs@postgresql.org; Fri, 12 Jun 2015 21:17:09 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [186.37.24.53]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id BAB1B400C84; Fri, 12 Jun 2015 14:16:54 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 11BD05A23; Fri, 12 Jun 2015 16:47:17 -0300 (CLT) Date: Fri, 12 Jun 2015 16:47:17 -0300 From: Alvaro Herrera To: Michael Paquier Cc: Bill Parker , PostgreSQL mailing lists Subject: Re: Lack of Sanity Checking in file 'pctcl.c' for PostgreSQL 9.4.x Message-ID: <20150612194716.GQ133018@postgresql.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -3.7 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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