shithub: aubio

Download patch

ref: d726526738c6c9f0dac04d673ec77e64695f9af8
parent: f19db54741e591f6f2111dd9687391967efb5983
author: Paul Brossier <piem@piem.org>
date: Thu Dec 6 06:40:48 EST 2018

[tests] prevent crash in test-awhitening, fix memory leaks

--- a/tests/src/spectral/test-awhitening.c
+++ b/tests/src/spectral/test-awhitening.c
@@ -41,9 +41,11 @@
   if (!o) { err = 1; goto beach_sink; }
 
   aubio_pvoc_t *pv = new_aubio_pvoc(win_size, hop_size);
+  if (!pv) { err = 1; goto beach_pvoc; }
 
   aubio_spectral_whitening_t *awhitening =
     new_aubio_spectral_whitening (win_size, hop_size, samplerate);
+  if (!awhitening) { err = 1; goto beach_awhitening; }
 
   aubio_spectral_whitening_set_relax_time(awhitening, 20.);
   fvec_set_all(scale, 3.);
@@ -71,11 +73,18 @@
       n_frames, samplerate, n_frames / hop_size,
       source_path, sink_path);
 
+  del_aubio_spectral_whitening(awhitening);
+beach_awhitening:
+  del_aubio_pvoc(pv);
+beach_pvoc:
   del_aubio_sink(o);
 beach_sink:
   del_aubio_source(i);
 beach_source:
   del_fvec(vec);
+  del_fvec(out);
+  del_fvec(scale);
+  del_cvec(fftgrain);
 beach_fvec:
   return err;
 }