From 8d4e0bc84e4a6cba6d111cd8502c01acd24f56e1 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 23 Feb 2020 21:21:11 +1000 Subject: [PATCH] Fix memory leaks in tests. --- tests/test_filtering/ma_test_filtering_bpf.c | 2 ++ tests/test_filtering/ma_test_filtering_dithering.c | 1 + tests/test_filtering/ma_test_filtering_hpf.c | 3 +++ tests/test_filtering/ma_test_filtering_loshelf.c | 4 +++- tests/test_filtering/ma_test_filtering_lpf.c | 3 +++ tests/test_filtering/ma_test_filtering_notch.c | 2 ++ tests/test_filtering/ma_test_filtering_peak.c | 2 ++ 7 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test_filtering/ma_test_filtering_bpf.c b/tests/test_filtering/ma_test_filtering_bpf.c index 54d73c3c..8ef6167a 100644 --- a/tests/test_filtering/ma_test_filtering_bpf.c +++ b/tests/test_filtering/ma_test_filtering_bpf.c @@ -49,6 +49,7 @@ ma_result test_bpf2__by_format(const char* pInputFilePath, const char* pOutputFi } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } @@ -109,6 +110,7 @@ ma_result test_bpf4__by_format(const char* pInputFilePath, const char* pOutputFi } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } diff --git a/tests/test_filtering/ma_test_filtering_dithering.c b/tests/test_filtering/ma_test_filtering_dithering.c index 6b07284c..6ba962a0 100644 --- a/tests/test_filtering/ma_test_filtering_dithering.c +++ b/tests/test_filtering/ma_test_filtering_dithering.c @@ -43,6 +43,7 @@ ma_result test_dithering__u8(const char* pInputFilePath) } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } diff --git a/tests/test_filtering/ma_test_filtering_hpf.c b/tests/test_filtering/ma_test_filtering_hpf.c index f88a54e9..e0dd1894 100644 --- a/tests/test_filtering/ma_test_filtering_hpf.c +++ b/tests/test_filtering/ma_test_filtering_hpf.c @@ -49,6 +49,7 @@ ma_result test_hpf1__by_format(const char* pInputFilePath, const char* pOutputFi } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } @@ -109,6 +110,7 @@ ma_result test_hpf2__by_format(const char* pInputFilePath, const char* pOutputFi } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } @@ -169,6 +171,7 @@ ma_result test_hpf3__by_format(const char* pInputFilePath, const char* pOutputFi } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } diff --git a/tests/test_filtering/ma_test_filtering_loshelf.c b/tests/test_filtering/ma_test_filtering_loshelf.c index b2d96ae2..efba93af 100644 --- a/tests/test_filtering/ma_test_filtering_loshelf.c +++ b/tests/test_filtering/ma_test_filtering_loshelf.c @@ -19,7 +19,7 @@ ma_result test_loshelf2__by_format(const char* pInputFilePath, const char* pOutp return result; } - loshelfConfig = ma_loshelf2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 6, 1, 1000); + loshelfConfig = ma_loshelf2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 6, 1, 200); result = ma_loshelf2_init(&loshelfConfig, &loshelf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); @@ -49,6 +49,7 @@ ma_result test_loshelf2__by_format(const char* pInputFilePath, const char* pOutp } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } @@ -109,6 +110,7 @@ ma_result test_loshelf4__by_format(const char* pInputFilePath, const char* pOutp } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } diff --git a/tests/test_filtering/ma_test_filtering_lpf.c b/tests/test_filtering/ma_test_filtering_lpf.c index 8e232a66..773a0de2 100644 --- a/tests/test_filtering/ma_test_filtering_lpf.c +++ b/tests/test_filtering/ma_test_filtering_lpf.c @@ -49,6 +49,7 @@ ma_result test_lpf1__by_format(const char* pInputFilePath, const char* pOutputFi } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } @@ -109,6 +110,7 @@ ma_result test_lpf2__by_format(const char* pInputFilePath, const char* pOutputFi } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } @@ -170,6 +172,7 @@ ma_result test_lpf3__by_format(const char* pInputFilePath, const char* pOutputFi } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } diff --git a/tests/test_filtering/ma_test_filtering_notch.c b/tests/test_filtering/ma_test_filtering_notch.c index ff74433b..4e5e6d40 100644 --- a/tests/test_filtering/ma_test_filtering_notch.c +++ b/tests/test_filtering/ma_test_filtering_notch.c @@ -49,6 +49,7 @@ ma_result test_notch2__by_format(const char* pInputFilePath, const char* pOutput } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } @@ -109,6 +110,7 @@ ma_result test_notch4__by_format(const char* pInputFilePath, const char* pOutput } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } diff --git a/tests/test_filtering/ma_test_filtering_peak.c b/tests/test_filtering/ma_test_filtering_peak.c index 835ebbe3..7d3181b3 100644 --- a/tests/test_filtering/ma_test_filtering_peak.c +++ b/tests/test_filtering/ma_test_filtering_peak.c @@ -49,6 +49,7 @@ ma_result test_peak2__by_format(const char* pInputFilePath, const char* pOutputF } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; } @@ -109,6 +110,7 @@ ma_result test_peak4__by_format(const char* pInputFilePath, const char* pOutputF } } + ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); return MA_SUCCESS; }