Re: Report some potential memory leak bugs in pg_dump.c

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: wliang(at)stu(dot)xidian(dot)edu(dot)cn
Cc: pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Report some potential memory leak bugs in pg_dump.c
Date: 2022-02-19 06:15:55
Message-ID: CAKFQuwYK9NOENP=cQdvnmZcN0nxaWDWySQ4RT5_opbr5MAMihQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Feb 18, 2022 at 10:59 PM <wliang(at)stu(dot)xidian(dot)edu(dot)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:

https://github.com/postgres/postgres/commit/072e2f8a62002cb01ed6c4e161442e133509349e

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

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-02-19 07:04:14 Re: Report some potential memory leak bugs in pg_dump.c
Previous Message wliang 2022-02-19 05:45:38 Report some potential memory leak bugs in pg_dump.c