https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123868
--- Comment #1 from Andrew Benson <abensonca at gcc dot gnu.org> --- This is a regression - the above code works as expected with no memory leak in 14.3, 15.1 and 15.2 (earlier versions fail with a segfault).
