From 540900d9097b34bdd2e9eb80d45841ba0bb02e9e Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 4 Dec 2019 08:16:38 -0500 Subject: [PATCH] Fix weird uninitialized memory error from Valgrind. --- src/dsp/minblep.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dsp/minblep.cpp b/src/dsp/minblep.cpp index cba79600..4cda55a0 100644 --- a/src/dsp/minblep.cpp +++ b/src/dsp/minblep.cpp @@ -21,6 +21,8 @@ void minBlepImpulse(int z, int o, float* output) { // Real cepstrum float* fx = new float[2 * n]; + // Valgrind complains that the array is uninitialized for some reason, unless we clear it. + std::memset(fx, 0, sizeof(float) * 2 * n); RealFFT rfft(n); rfft.rfft(x, fx); // fx = log(abs(fx))