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 <[email protected]>
Author: Satya Narlapuram <[email protected]>
Discussion: 
https://postgr.es/m/cahg+qddwtv9pktpzeokwgcntbv4mvnfyw5wmzrsej4xizsn...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1f108fc02ece09da5773ece74e25812cb952ebfc

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

Reply via email to