summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2023-02-15 21:17:41 -0800
committerPokechu22 <Pokechu022@gmail.com>2023-02-15 21:56:49 -0800
commita7026ca6d37a6ab63c8652fdcc538beb60240b10 (patch)
tree2204077f33e25355ae4f21a141bef69bde48f714
parent19bf13d3bb2c02f00c1fb01da6f9c6e381a087e4 (diff)
Externals/FreeSurround: Fix pointer created through new[] being freed via delete
Doing so is not allowed (presumably because compilers are allowed to use a different algorithm for allocating between the two/store extra data such as the length of the array before the pointer). This bug existed in the original implementation at https://web.archive.org/web/20140708092159/http://www.hydrogenaud.io/forums/index.php?showtopic=52235 and causes Valgrind to emit a warning. Note that this ended up happening even if DSPLLE and the DPL decoder are not enabled in Dolphin.
-rw-r--r--Externals/FreeSurround/source/FreeSurroundDecoder.cpp6
-rw-r--r--Externals/FreeSurround/source/KissFFTR.cpp2
2 files changed, 3 insertions, 5 deletions
diff --git a/Externals/FreeSurround/source/FreeSurroundDecoder.cpp b/Externals/FreeSurround/source/FreeSurroundDecoder.cpp
index b65734a5cb..10b45ff753 100644
--- a/Externals/FreeSurround/source/FreeSurroundDecoder.cpp
+++ b/Externals/FreeSurround/source/FreeSurroundDecoder.cpp
@@ -31,10 +31,8 @@ DPL2FSDecoder::DPL2FSDecoder() {
}
DPL2FSDecoder::~DPL2FSDecoder() {
-#pragma warning(suppress : 4150)
- delete forward;
-#pragma warning(suppress : 4150)
- delete inverse;
+ kiss_fftr_free(forward);
+ kiss_fftr_free(inverse);
}
void DPL2FSDecoder::Init(channel_setup chsetup, unsigned int blsize,
diff --git a/Externals/FreeSurround/source/KissFFTR.cpp b/Externals/FreeSurround/source/KissFFTR.cpp
index 41b13d43d3..b62612b8ff 100644
--- a/Externals/FreeSurround/source/KissFFTR.cpp
+++ b/Externals/FreeSurround/source/KissFFTR.cpp
@@ -65,7 +65,7 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft, int inverse_fft, void *mem,
sizeof(kiss_fft_cpx) * (nfft * 3 / 2);
if (lenmem == NULL) {
- st = (kiss_fftr_cfg) new char[memneeded];
+ st = (kiss_fftr_cfg)malloc(memneeded);
} else {
if (*lenmem >= memneeded)
st = (kiss_fftr_cfg)mem;