Re: Report a potential memory leak in describeOneTableDetails() - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Report a potential memory leak in describeOneTableDetails()
Date
Msg-id 3052377.1644943008@sss.pgh.pa.us
Whole thread Raw
In response to Report a potential memory leak in describeOneTableDetails()  (wliang@stu.xidian.edu.cn)
List pgsql-bugs
wliang@stu.xidian.edu.cn writes:
> I find a potential memory leak in PostgresSQL 14.1, which is in the function describeOneTableDetails
(./src/bin/psql/describe.c).

Do you want to submit a patch?  The amount of memory involved here isn't
much, but since psql is a potentially long-running program, it seems worth
the trouble to be careful.

I think the best fix might be to drop these strdup's altogether, and
instead postpone freeing the PGresult to the end of the function, so
that we can just use the pointers returned by PQgetvalue.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Report a potential memory leak in setup_config()
Next
From: Masahiko Sawada
Date:
Subject: Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end