From 54363e5eb84faf7f00f0b98ba587d619924eb724 Mon Sep 17 00:00:00 2001 From: Sergey Pilyushkin Date: Fri, 22 Jul 2022 15:53:25 +0300 Subject: [PATCH] Added pointer check --- src/audiofilters/genericplc.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/audiofilters/genericplc.c b/src/audiofilters/genericplc.c index 5e144d0206..d632510194 100644 --- a/src/audiofilters/genericplc.c +++ b/src/audiofilters/genericplc.c @@ -59,14 +59,16 @@ plc_context_t *generic_plc_create_context(int sample_rate) { } void generic_plc_destroy_context(plc_context_t *context) { - ms_free(context->continuity_buffer); - ms_free(context->plc_buffer); - ms_free(context->hamming_window); - ms_free(context->plc_out_buffer); - ms_fft_destroy(context->fft_to_frequency_context); - ms_fft_destroy(context->fft_to_time_context); - - ms_free(context); + if (context) { + ms_free(context->continuity_buffer); + ms_free(context->plc_buffer); + ms_free(context->hamming_window); + ms_free(context->plc_out_buffer); + ms_fft_destroy(context->fft_to_frequency_context); + ms_fft_destroy(context->fft_to_time_context); + + ms_free(context); + } } void generic_plc_fftbf(plc_context_t *context, int16_t *input_buffer, int16_t *output_buffer, size_t input_buffer_len) {