Changeset 7c785e6 for python/ext


Ignore:
Timestamp:
Apr 18, 2016, 9:14:41 PM (9 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, pitchshift, sampler, timestretch, yinfft+
Children:
4041a6d
Parents:
de81d2b
Message:

ext/py-filter.c: continue fixing memory leak (#49)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/py-filter.c

    rde81d2b r7c785e6  
    66  aubio_filter_t * o;
    77  uint_t order;
     8  fvec_t *out;
    89} Py_filter;
    910
     
    4849    return -1;
    4950  }
    50 
     51  self->out = new_fvec(Py_default_vector_length);
    5152  return 0;
    5253}
     
    5556Py_filter_del (Py_filter * self)
    5657{
     58  del_fvec(self->out);
    5759  del_aubio_filter (self->o);
    5860  self->ob_type->tp_free ((PyObject *) self);
     
    7981  }
    8082
     83  // reallocate the output if needed
     84  if (vec->length != self->out->length) {
     85    del_fvec(self->out);
     86    self->out = new_fvec(vec->length);
     87  }
    8188  // compute the function
    82   fvec_t * out = new_fvec(vec->length);
    83   aubio_filter_do_outplace (self->o, vec, out);
    84   return PyAubio_CFvecToArray(out);
     89  aubio_filter_do_outplace (self->o, vec, self->out);
     90  return PyAubio_CFvecToArray(self->out);
    8591}
    8692
Note: See TracChangeset for help on using the changeset viewer.