Re: Report a potential memory leak in setup_config()
От
Daniel Gustafsson
Тема
Re: Report a potential memory leak in setup_config()
Дата
Msg-id
A7070803-5A15-486E-AE04-ECC13CD10038@yesql.se
Ответ на
Report a potential memory leak in setup_config() (wliang@stu.xidian.edu.cn)
Список
Дерево обсуждения
Report a potential memory leak in setup_config() wliang@stu.xidian.edu.cn
Re: Report a potential memory leak in setup_config() wliang@stu.xidian.edu.cn
Re: Report a potential memory leak in setup_config() Daniel Gustafsson <daniel@yesql.se>
Re: Report a potential memory leak in setup_config() Tom Lane <tgl@sss.pgh.pa.us>
Re: Report a potential memory leak in setup_config() Andres Freund <andres@anarazel.de>
Re: Report a potential memory leak in setup_config() Tom Lane <tgl@sss.pgh.pa.us>
Re: Report a potential memory leak in setup_config() Andres Freund <andres@anarazel.de>
Re: Report a potential memory leak in setup_config() Tom Lane <tgl@sss.pgh.pa.us>
Re: Report a potential memory leak in setup_config() Tom Lane <tgl@sss.pgh.pa.us>
Re: Report a potential memory leak in setup_config() Andres Freund <andres@anarazel.de>
Re: Report a potential memory leak in setup_config() Tom Lane <tgl@sss.pgh.pa.us>
Re: Report a potential memory leak in setup_config() Andres Freund <andres@anarazel.de>
Re: Report a potential memory leak in setup_config() Tom Lane <tgl@sss.pgh.pa.us>
Re: Report a potential memory leak in setup_config() wliang@stu.xidian.edu.cn
Re: Report a potential memory leak in setup_config() Tom Lane <tgl@sss.pgh.pa.us>
> On 15 Feb 2022, at 02:49, wliang@stu.xidian.edu.cn wrote: > Specifically, at line 1095, function pretty_wal_size() is called, which allocates a chunk of memory by using pg_malloc and returns it. However, the return chunk is directly passed to snprintf as its 3rd parameter. As a result, there is a memory leak. PostgreSQL isn't all too concerned about small static leaks in short lived programs, like initdb. Memory will be freed shortly when the program exits. Complicating the code to save 28 bytes seems hardly worth it, but if you feel strongly about it I suggest proposing a patch to fix it. -- Daniel Gustafsson https://vmware.com/
В списке pgsql-bugs по дате отправления
От: hubert depesz lubaczewski
Дата:
От: Troy Frericks
Дата: