Re: Re all: Report some potential memory leak bugs in pg_dump.c - Mailing list pgsql-bugs

From Julien Rouhaud
Subject Re: Re all: Report some potential memory leak bugs in pg_dump.c
Date
Msg-id 20220219111005.57bfn4qshuqxzkzi@jrouhaud
Whole thread Raw
In response to Re all: Report some potential memory leak bugs in pg_dump.c  (wliang@stu.xidian.edu.cn)
Responses Re: Re: Re all: Report some potential memory leak bugs in pg_dump.c  (wliang@stu.xidian.edu.cn)
Re: Re all: Report some potential memory leak bugs in pg_dump.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hi,

On Sat, Feb 19, 2022 at 04:04:38PM +0800, wliang@stu.xidian.edu.cn wrote:
> However, there are also some potential leaks caused by convertTSFunction()
> rather than getFormattedTypeName(). Besides, in convertTSFunction(), there
> are no any comment to say that the memory should not be freed by the caller.

Indeed this function doesn't cache anything and explicitly calls pg_strdup.

Here the amount of leaked memory is likely to be very small (I never heard of
people having thousands of text search templates or parsers), and pg_dump isn't
a long lived process so probably no one thought it was worth to extra code to
free that memory, which I agree with.



pgsql-bugs by date:

Previous
From: wliang@stu.xidian.edu.cn
Date:
Subject: Re all: Report some potential memory leak bugs in pg_dump.c
Next
From: wliang@stu.xidian.edu.cn
Date:
Subject: Re: Re: Re all: Report some potential memory leak bugs in pg_dump.c