pgsql: Fix memory allocation/copy mistakes.

From: Etsuro Fujita <efujita(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix memory allocation/copy mistakes.
Date: 2025-05-03 11:00:43
Message-ID: E1uBAbr-000lXI-0g@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix memory allocation/copy mistakes.

The previous code was allocating more memory and copying more data than
necessary because it specified the wrong PgStat_KindInfo member as the
size argument for MemoryContextAlloc and memcpy, respectively.

Although these issues exist since 5891c7a8e, there have been no reports
from the field. So for now, it seems sufficient to fix them in master.

Author: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Reviewed-by: Gurjeet Singh <gurjeet(at)singh(dot)im>
Discussion: https://postgr.es/m/CAPmGK15eTRCZTnfgQ4EuBNo%3DQLYGFEbXS_7m2dXqtkcT7L8qrQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5201bba266d7127397e08a2d954faa5a996c0139

Modified Files
--------------
src/backend/utils/activity/pgstat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2025-05-03 16:19:57 pgsql: doc PG 18 relnotes: move protocol version item to "server"
Previous Message Etsuro Fujita 2025-05-03 10:26:26 pgsql: Fix typos in comments.