From: Paul Brossier Date: Thu, 13 Jul 2006 15:57:21 +0000 (+0000) Subject: fix memory freeing in onsetdetection, remove useless _alloc X-Git-Tag: bzr2git~618 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c62141591cadf438920632793215ed9282740c16;p=aubio.git fix memory freeing in onsetdetection, remove useless _alloc fix memory freeing in onsetdetection, remove useless _alloc --- diff --git a/src/onsetdetection.c b/src/onsetdetection.c index b0f7a3bb..b1f6ccb3 100644 --- a/src/onsetdetection.c +++ b/src/onsetdetection.c @@ -40,8 +40,6 @@ struct _aubio_onsetdetection_t { }; -static aubio_onsetdetection_t * aubio_onsetdetection_alloc(aubio_onsetdetection_type type, uint_t size, uint_t channels); - /* Energy based onset detection function */ void aubio_onsetdetection_energy (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset) { @@ -192,17 +190,12 @@ aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, o->funcpointer(o,fftgrain,onset); } -/* Allocate memory for an onset detection */ +/* Allocate memory for an onset detection + * depending on the choosen type, allocate memory as needed + */ aubio_onsetdetection_t * new_aubio_onsetdetection (aubio_onsetdetection_type type, uint_t size, uint_t channels){ - return aubio_onsetdetection_alloc(type,size,channels); -} - -/* depending on the choosen type, allocate memory as needed */ -aubio_onsetdetection_t * -aubio_onsetdetection_alloc (aubio_onsetdetection_type type, - uint_t size, uint_t channels){ aubio_onsetdetection_t * o = AUBIO_NEW(aubio_onsetdetection_t); uint_t rsize = size/2+1; switch(type) { @@ -307,6 +300,12 @@ void del_aubio_onsetdetection (aubio_onsetdetection_t *o){ del_fvec(o->dev1); del_aubio_hist(o->histog); break; + case aubio_onset_kl: + del_fvec(o->oldmag); + break; + case aubio_onset_mkl: + del_fvec(o->oldmag); + break; default: break; }