Re: potential memory leak in pg_regcomp() - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: potential memory leak in pg_regcomp()
Date
Msg-id YttrDZ/W39IWeNhG@paquier.xyz
Whole thread Raw
In response to potential memory leak in pg_regcomp()  (Zhihong Yu <zyu@yugabyte.com>)
List pgsql-hackers
On Fri, Jul 22, 2022 at 08:20:04PM -0700, Zhihong Yu wrote:
> Hi,
> I was looking at pg_regcomp():
>
>     re->re_guts = VS(MALLOC(sizeof(struct guts)));
>
> I did some search trying to find where re_guts is freed but haven't
> found it.
> Can someone enlighten me?

Oops.  It seems that you are right and that there is room for
improvement here.  regguts.h defines MALLOC() as a simple malloc()..
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Make name optional in CREATE STATISTICS
Next
From: Thomas Munro
Date:
Subject: Re: Removing obsolete configure checks