From 79b54ea4ea3a2d413a10447a937ef3a6337dfb71 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 25 Aug 2014 22:24:56 -0500 Subject: [PATCH] src/synth/sampler.c: make sure blocksize > 0 --- src/synth/sampler.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 ) -- 2.11.0