Re: BUG #15103: Do not use pfree() to free pg_malloc() return value in vacuum_one_database()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: bianpan2016(at)163(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15103: Do not use pfree() to free pg_malloc() return value in vacuum_one_database()
Date: 2018-03-09 01:48:41
Message-ID: 20180309014841.GA25687@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Mar 09, 2018 at 01:32:47AM +0000, PG Bug reporting form wrote:
> Details: In function vacuum_one_database(), the memory allocated with
> pg_malloc() (at line 435), but the return value is freed with pfree() (at
> line 530). I think use the function pg_free() paired with pg_malloc() is
> better here.

In practice it does not matter much as pfree is just a wrapper on top of
pg_free(). Please see fe_memutils.c, which lists all the memory-related
APIs for frontends.
--
Michael

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-03-09 03:29:25 BUG #15105: OpenTransientFile() should be paired with CloseTransientFile() rather than close()
Previous Message PG Bug reporting form 2018-03-09 01:48:40 BUG #15104: Double free in the main function in ecpg.c