pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: psql: Fix memory leak with repeated calls of \bind
2+ messages / 1 participants
[nested] [flat]

* pgsql: psql: Fix memory leak with repeated calls of \bind
@ 2024-09-19 07:25  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2024-09-19 07:25 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

psql: Fix memory leak with repeated calls of \bind

Calling \bind repeatedly would cause the memory allocated for the list
of bind parameters to be leaked after each call, as the list is reset
when beginning a single call.

This issue is fixed by making the cleanup of the bind parameter list
more aggressive, refactoring it into a single routine called after
processing a query and before running an individual \bind.

HEAD required more surgery and has been fixed by 87eeadaea143.  Issue
introduced by 5b66de3433e2.

Reported-by: Anthonin Bonnefoy
Discussion: https://postgr.es/m/2e5b89af-a351-ff0a-000c-037ac28314ab@gmail.com
Backpatch-through: 16

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c2fb2f9e200f43133e4d910d4d9c27cf5e1bb29d

Modified Files
--------------
src/bin/psql/command.c |  2 +-
src/bin/psql/common.c  | 29 +++++++++++++++++++++--------
src/bin/psql/common.h  |  1 +
3 files changed, 23 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: psql: Fix memory leak with repeated calls of \bind
@ 2024-09-19 07:25  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2024-09-19 07:25 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

psql: Fix memory leak with repeated calls of \bind

Calling \bind repeatedly would cause the memory allocated for the list
of bind parameters to be leaked after each call, as the list is reset
when beginning a single call.

This issue is fixed by making the cleanup of the bind parameter list
more aggressive, refactoring it into a single routine called after
processing a query and before running an individual \bind.

HEAD required more surgery and has been fixed by 87eeadaea143.  Issue
introduced by 5b66de3433e2.

Reported-by: Anthonin Bonnefoy
Discussion: https://postgr.es/m/2e5b89af-a351-ff0a-000c-037ac28314ab@gmail.com
Backpatch-through: 16

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b0ae6db2088bbd1d16733b359c9c300735e9c21e

Modified Files
--------------
src/bin/psql/command.c |  2 +-
src/bin/psql/common.c  | 29 +++++++++++++++++++++--------
src/bin/psql/common.h  |  1 +
3 files changed, 23 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-09-19 07:25 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-19 07:25 pgsql: psql: Fix memory leak with repeated calls of \bind Michael Paquier <michael@paquier.xyz>
2024-09-19 07:25 pgsql: psql: Fix memory leak with repeated calls of \bind Michael Paquier <michael@paquier.xyz>

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