https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118400

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So I think we want
2025-01-14  Jakub Jelinek  <ja...@redhat.com>

        PR ipa/118400
        * vec.h (vec<T, va_heap, vl_ptr>::release): Call vec_destruct
        in the using_auto_storage () case.

--- gcc/vec.h.jj        2025-01-02 11:23:13.144563938 +0100
+++ gcc/vec.h   2025-01-14 19:44:59.105506682 +0100
@@ -2020,6 +2020,8 @@ vec<T, va_heap, vl_ptr>::release (void)

   if (using_auto_storage ())
     {
+      if (!std::is_trivially_destructible <T>::value)
+       vec_destruct (m_vec->address (), m_vec->length ());
       m_vec->m_vecpfx.m_num = 0;
       return;
     }
Fixes the leak for me, will test tonight.

Reply via email to