Changeset e4e0861


Ignore:
Timestamp:
Nov 24, 2018, 6:53:12 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
0f5f40b
Parents:
c4a8bc1
Message:

[onset] safer deletion method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/onset.c

    rc4a8bc1 re4e0861  
    257257  o->pp = new_aubio_peakpicker();
    258258  o->od = new_aubio_specdesc(onset_mode,buf_size);
    259   if (o->od == NULL) goto beach_specdesc;
    260259  o->fftgrain = new_cvec(buf_size);
    261260  o->desc = new_fvec(1);
    262261  o->spectral_whitening = new_aubio_spectral_whitening(buf_size, hop_size, samplerate);
    263262
     263  if (!o->pv || !o->pp || !o->od || !o->fftgrain
     264      || !o->desc || !o->spectral_whitening)
     265    goto beach;
     266
    264267  /* initialize internal variables */
    265268  aubio_onset_set_default_parameters (o, onset_mode);
     
    268271  return o;
    269272
    270 beach_specdesc:
    271   del_aubio_peakpicker(o->pp);
    272   del_aubio_pvoc(o->pv);
    273273beach:
    274   AUBIO_FREE(o);
     274  del_aubio_onset(o);
    275275  return NULL;
    276276}
     
    340340void del_aubio_onset (aubio_onset_t *o)
    341341{
    342   del_aubio_spectral_whitening(o->spectral_whitening);
    343   del_aubio_specdesc(o->od);
    344   del_aubio_peakpicker(o->pp);
    345   del_aubio_pvoc(o->pv);
    346   del_fvec(o->desc);
    347   del_cvec(o->fftgrain);
     342  if (o->spectral_whitening)
     343    del_aubio_spectral_whitening(o->spectral_whitening);
     344  if (o->od)
     345    del_aubio_specdesc(o->od);
     346  if (o->pp)
     347    del_aubio_peakpicker(o->pp);
     348  if (o->pv)
     349    del_aubio_pvoc(o->pv);
     350  if (o->desc)
     351    del_fvec(o->desc);
     352  if (o->fftgrain)
     353    del_cvec(o->fftgrain);
    348354  AUBIO_FREE(o);
    349355}
Note: See TracChangeset for help on using the changeset viewer.