pgsql: Avoid memory leak on error while parsing pg_stat_statements dump

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid memory leak on error while parsing pg_stat_statements dump
Date: 2026-03-27 11:12:05
Message-ID: E1w656j-001gcy-0H@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid memory leak on error while parsing pg_stat_statements dump file

By using palloc() instead of raw malloc().

Reported-by: Gaurav Singh <gaurav(dot)singh(at)yugabyte(dot)com>
Reviewed-by: Lukas Fittl <lukas(at)fittl(dot)com>
Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Discussion: https://www.postgresql.org/message-id/CAEcQ1bYR9s4eQLFDjzzJHU8fj-MTbmRpW-9J-r2gsCn+HEsynw@mail.gmail.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3c74cb5762db6373187c3cf83f1b955e88773e33

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-03-27 11:12:06 pgsql: Avoid memory leak on error while parsing pg_stat_statements dump
Previous Message Peter Eisentraut 2026-03-27 09:55:29 pgsql: Add a graph pattern variable only once