From: Tom Lane <tgl@sss.pgh.pa.us>
To: wliang@stu.xidian.edu.cn
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: Re: Report a potential memory leak in describeOneTableDetails()
Date: Tue, 15 Feb 2022 11:36:48 -0500
Message-ID: <3052377.1644943008@sss.pgh.pa.us> (raw)
In-Reply-To: <110a333f.359.17efb204b17.Coremail.wliang@stu.xidian.edu.cn>
References: <110a333f.359.17efb204b17.Coremail.wliang@stu.xidian.edu.cn>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, wliang@stu.xidian.edu.cn, pgsql-bugs@lists.postgresql.org
Subject: Re: Report a potential memory leak in describeOneTableDetails()
In-Reply-To: <3052377.1644943008@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox