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

From David G. Johnston
Subject Re: Report some potential memory leak bugs in pg_dump.c
Date
Msg-id CAKFQuwYK9NOENP=cQdvnmZcN0nxaWDWySQ4RT5_opbr5MAMihQ@mail.gmail.com
Whole thread Raw
In response to Report some potential memory leak bugs in pg_dump.c  (wliang@stu.xidian.edu.cn)
Responses Re: Report some potential memory leak bugs in pg_dump.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Fri, Feb 18, 2022 at 10:59 PM <wliang@stu.xidian.edu.cn> wrote:
Specifically, at line 10545 and line 10546, function getFormattedTypeName() is called, which allocates a chunk of memory by using pg_strdup() and returns it.

I'm not a C programmer but am operating under the assumption that you are probably incorrect.  So I took a cursory look at the code (in HEAD), starting with the function comment.  It says:

"* Note that the result is cached and must not be freed by the caller."

Then,  using git blame, I found this commit:


That commit made it in before v14 was released and so was already in v14.1

David J.

pgsql-bugs by date:

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