Changeset b5a0479


Ignore:
Timestamp:
Nov 24, 2018, 6:21:54 PM (5 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:
be83390
Parents:
88d3d31
Message:

[tempo] make sure all objects have been created, safer del_ method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tempo/tempo.c

    r88d3d31 rb5a0479  
    217217    onset2 = new_fvec(1);
    218218  }*/
     219  if (!o->dfframe || !o->fftgrain || !o->out || !o->pv ||
     220      !o->pp || !o->od || !o->of || !o->bt || !o->onset) {
     221    AUBIO_ERR("tempo: failed creating tempo object\n");
     222    goto beach;
     223  }
    219224  o->last_tatum = 0;
    220225  o->tatum_signature = 4;
     
    222227
    223228beach:
    224   AUBIO_FREE(o);
     229  del_aubio_tempo(o);
    225230  return NULL;
    226231}
     
    279284void del_aubio_tempo (aubio_tempo_t *o)
    280285{
    281   del_aubio_specdesc(o->od);
    282   del_aubio_beattracking(o->bt);
    283   del_aubio_peakpicker(o->pp);
    284   del_aubio_pvoc(o->pv);
    285   del_fvec(o->out);
    286   del_fvec(o->of);
    287   del_cvec(o->fftgrain);
    288   del_fvec(o->dfframe);
    289   del_fvec(o->onset);
     286  if (o->od)
     287    del_aubio_specdesc(o->od);
     288  if (o->bt)
     289    del_aubio_beattracking(o->bt);
     290  if (o->pp)
     291    del_aubio_peakpicker(o->pp);
     292  if (o->pv)
     293    del_aubio_pvoc(o->pv);
     294  if (o->out)
     295    del_fvec(o->out);
     296  if (o->of)
     297    del_fvec(o->of);
     298  if (o->fftgrain)
     299    del_cvec(o->fftgrain);
     300  if (o->dfframe)
     301    del_fvec(o->dfframe);
     302  if (o->onset)
     303    del_fvec(o->onset);
    290304  AUBIO_FREE(o);
    291   return;
    292 }
     305}
Note: See TracChangeset for help on using the changeset viewer.