Changeset 4cb7a0a for src


Ignore:
Timestamp:
Jan 12, 2017, 10:59:04 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, sampler, yinfft+
Children:
9da4202
Parents:
0f2c1f4
Message:

src/pitch/pitch.c: return NULL if creation failed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitch/pitch.c

    r0f2c1f4 r4cb7a0a  
    156156      p->buf = new_fvec (bufsize);
    157157      p->p_object = new_aubio_pitchyin (bufsize);
     158      if (!p->p_object) goto beach;
    158159      p->detect_cb = aubio_pitch_do_yin;
    159160      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyin_get_confidence;
     
    163164      p->filtered = new_fvec (hopsize);
    164165      p->pv = new_aubio_pvoc (bufsize, hopsize);
     166      if (!p->pv) goto beach;
    165167      p->fftgrain = new_cvec (bufsize);
    166168      p->p_object = new_aubio_pitchmcomb (bufsize, hopsize);
     
    171173      p->buf = new_fvec (bufsize);
    172174      p->p_object = new_aubio_pitchfcomb (bufsize, hopsize);
     175      if (!p->p_object) goto beach;
    173176      p->detect_cb = aubio_pitch_do_fcomb;
    174177      break;
     
    181184      p->buf = new_fvec (bufsize);
    182185      p->p_object = new_aubio_pitchyinfft (samplerate, bufsize);
     186      if (!p->p_object) goto beach;
    183187      p->detect_cb = aubio_pitch_do_yinfft;
    184188      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyinfft_get_confidence;
     
    188192      p->buf = new_fvec (bufsize);
    189193      p->p_object = new_aubio_pitchspecacf (bufsize);
     194      if (!p->p_object) goto beach;
    190195      p->detect_cb = aubio_pitch_do_specacf;
    191196      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchspecacf_get_tolerance;
     
    198203
    199204beach:
     205  if (p->filtered) del_fvec(p->filtered);
     206  if (p->buf) del_fvec(p->buf);
    200207  AUBIO_FREE(p);
    201208  return NULL;
Note: See TracChangeset for help on using the changeset viewer.