From f0a8b8cd6deb6a27ce4174d4b63360786a6441ee Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 7 May 2022 04:18:29 +0200 Subject: [PATCH] Fix an unlikely memory leak in zita-resampler --- libs/zita-resampler/resampler.cc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libs/zita-resampler/resampler.cc b/libs/zita-resampler/resampler.cc index 931a2a4fec..03788b5e33 100644 --- a/libs/zita-resampler/resampler.cc +++ b/libs/zita-resampler/resampler.cc @@ -98,15 +98,19 @@ Resampler::setup (unsigned int fs_inp, } } clear (); - if (T) { - _table = T; - _buff = B; - _nchan = nchan; - _inmax = k; - _pstep = s; - return reset (); + + if (!T || !B) { + Resampler_table::destroy (T); + delete [] B; + return 1; } - else return 1; + + _table = T; + _buff = B; + _nchan = nchan; + _inmax = k; + _pstep = s; + return reset (); } void