Re: BUG #15103: Do not use pfree() to free pg_malloc() return valuein vacuum_one_database() - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #15103: Do not use pfree() to free pg_malloc() return valuein vacuum_one_database()
Date
Msg-id 20180309014841.GA25687@paquier.xyz
Whole thread Raw
In response to BUG #15103: Do not use pfree() to free pg_malloc() return value invacuum_one_database()  (PG Bug reporting form <noreply@postgresql.org>)
List 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

Attachment

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15104: Double free in the main function in ecpg.c
Next
From: PG Bug reporting form
Date:
Subject: BUG #15105: OpenTransientFile() should be paired withCloseTransientFile() rather than close()