From f27e73989c9831cde96880edafb01e662a7de2db Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat@gmail.com>
Date: Wed, 5 Jun 2019 17:09:15 -0700
Subject: Properly destroy the limiter's extra fields

---
 Alc/mastering.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'Alc')

diff --git a/Alc/mastering.cpp b/Alc/mastering.cpp
index 00b79e67..f5d36a59 100644
--- a/Alc/mastering.cpp
+++ b/Alc/mastering.cpp
@@ -15,7 +15,7 @@
 static_assert((BUFFERSIZE & (BUFFERSIZE-1)) == 0, "BUFFERSIZE is not a power of 2");
 
 struct SlidingHold {
-    ALfloat mValues[BUFFERSIZE];
+    alignas(16) ALfloat mValues[BUFFERSIZE];
     ALsizei mExpiries[BUFFERSIZE];
     ALsizei mLowerIndex;
     ALsizei mUpperIndex;
@@ -401,15 +401,15 @@ std::unique_ptr<Compressor> CompressorInit(const ALsizei NumChans, const ALuint
     {
         if(hold > 1)
         {
-            Comp->mHold = new (static_cast<void*>(Comp.get() + 1)) SlidingHold{};
+            Comp->mHold = ::new (static_cast<void*>(Comp.get() + 1)) SlidingHold{};
             Comp->mHold->mValues[0] = -std::numeric_limits<float>::infinity();
             Comp->mHold->mExpiries[0] = hold;
             Comp->mHold->mLength = hold;
-            Comp->mDelay = new (static_cast<void*>(Comp->mHold + 1)) FloatBufferLine{};
+            Comp->mDelay = ::new (static_cast<void*>(Comp->mHold + 1)) FloatBufferLine[NumChans];
         }
         else
         {
-            Comp->mDelay = new (static_cast<void*>(Comp.get() + 1)) FloatBufferLine{};
+            Comp->mDelay = ::new (static_cast<void*>(Comp.get() + 1)) FloatBufferLine[NumChans];
         }
     }
 
@@ -423,10 +423,10 @@ std::unique_ptr<Compressor> CompressorInit(const ALsizei NumChans, const ALuint
 Compressor::~Compressor()
 {
     if(mHold)
-        mHold->~SlidingHold();
+        al::destroy_at(mHold);
     mHold = nullptr;
     if(mDelay)
-        mDelay->~FloatBufferLine();
+        al::destroy_n(mDelay, mNumChans);
     mDelay = nullptr;
 }
 
-- 
cgit v1.2.3