]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix pfree crash in pg_get_role_ddl() and pg_get_database_ddl().
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 14 Apr 2026 22:25:36 +0000 (18:25 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Tue, 14 Apr 2026 22:29:46 +0000 (18:29 -0400)
commit1f108fc02ece09da5773ece74e25812cb952ebfc
tree21564f1de910205f7e0ab7e1198663142c82e25c
parentdacd8fa6f259e25f747d6d71290d9d5ed86095df
Fix pfree crash in pg_get_role_ddl() and pg_get_database_ddl().

DatumGetArrayTypeP() can return a pointer into the tuple when the
datum is stored as a short varlena, so pfree() on the result crashes.
Use DatumGetArrayTypePCopy() to always get a palloc'd copy.

Bug introduced in 76e514ebb4b and a4f774cf1c7.

Reported-by: Jeff Davis <pgsql@j-davis.com>
Author: Satya Narlapuram <satya.narlapuram@gmail.com>
Discussion: https://postgr.es/m/CAHg+QDdWtv9PKtPZEokwGCNtbv4MVnfYw5wMZrsEj4xizSNe5Q@mail.gmail.com
src/backend/utils/adt/ddlutils.c