Re: Potential memory leak in contrib/intarray's g_intbig_compress

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Konstantin Knizhnik <knizhnik@garret.ru>
Date: 2023-07-14T05:57:29Z
Lists: pgsql-hackers

Attachments

On Thu, Jul 13, 2023 at 06:28:39PM +0200, Matthias van de Meent wrote:
> There are similar pfree calls in the _int_gist.c file's g_int_compress
> function, which made me think we do need to clean up after use, but
> indeed these pfrees are useless (or even harmful if bug #17888 can be
> trusted)

Indeed, all these are in a GiST temporary context.  So you'd mean
something like the attached perhaps, for both the decompress and
compress paths?
--
Michael

Commits

  1. Remove unnecessary pfree() in g_intbig_compress().