From: Paul Brossier Date: Tue, 26 Aug 2014 03:24:56 +0000 (-0500) Subject: src/synth/sampler.c: make sure blocksize > 0 X-Git-Tag: 0.4.2~64 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=79b54ea4ea3a2d413a10447a937ef3a6337dfb71;p=aubio.git src/synth/sampler.c: make sure blocksize > 0 --- diff --git a/src/synth/sampler.c b/src/synth/sampler.c index d6e5fd3b..e1db75d8 100644 --- a/src/synth/sampler.c +++ b/src/synth/sampler.c @@ -39,6 +39,10 @@ struct _aubio_sampler_t { 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 @@ aubio_sampler_t *new_aubio_sampler(uint_t samplerate, uint_t blocksize) 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 )