A use-after-free vulnerability in PostgreSQL portal setup allows an object creator to execute arbitrary code as the operating system user running the database. This occurs when user-defined code executed during planning or executor startup closes the portal currently being prepared. Versions prior to PostgreSQL 14.25, 15.20, 16.16, 17.12, and 18.7 are affected.