wliang(at)stu(dot)xidian(dot)edu(dot)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