shithub: aubio

Download patch

ref: 79b54ea4ea3a2d413a10447a937ef3a6337dfb71
parent: 2722dc714a036f920b067e71d7257d2fbc46c9c1
author: Paul Brossier <[email protected]>
date: Mon Aug 25 18:24:56 EDT 2014

src/synth/sampler.c: make sure blocksize > 0

--- a/src/synth/sampler.c
+++ b/src/synth/sampler.c
@@ -39,6 +39,10 @@
 aubio_sampler_t *new_aubio_sampler(uint_t samplerate, uint_t blocksize)
 {
   aubio_sampler_t *s = AUBIO_NEW(aubio_sampler_t);
+  if ((sint_t)blocksize < 1) {
+    AUBIO_ERR("sampler: got blocksize %d, but can not be < 1\n", blocksize);
+    goto beach;
+  }
   s->samplerate = samplerate;
   s->blocksize = blocksize;
   s->source_output = new_fvec(blocksize);
@@ -46,6 +50,9 @@
   s->source = NULL;
   s->playing = 0;
   return s;
+beach:
+  AUBIO_FREE(s);
+  return NULL;
 }
 
 uint_t aubio_sampler_load( aubio_sampler_t * o, char_t * uri )