Re: Small psql memory fix

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Small psql memory fix
Date: 2014-02-15 04:35:08
Message-ID: 20140215043508.GB15047@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 14, 2014 at 11:28:49PM -0500, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > The attached tiny patch fixes a small leak in psql's \gset command and
> > simplifies memory freeing in two places.
>
> The first and third hunks look to me like they introduce memory
> leaks, not fix them. The second hunk is probably safe enough,

The first and third just move the free into blocks where we have already
tested the value is not null. It just more clearly matches the
surrounding code. Do you see something different?

> although I'm not sure the case can actually occur --- gset should
> free the prefix before any new backslash command can be executed.

Oh, interesting idea. Updated patch attached.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachment Content-Type Size
psql.diff text/x-diff 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-02-15 04:52:42 Re: Small psql memory fix
Previous Message Tom Lane 2014-02-15 04:28:49 Re: Small psql memory fix