Ignore:
Timestamp:
Jul 14, 2012, 8:39:09 PM (12 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:
2c3d4ca
Parents:
6192ce7
Message:

src/io/source_sndfile.c: return NULL before trying to allocate memory, clean up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_sndfile.c

    r6192ce7 raf86999  
    2929#include "source_sndfile.h"
    3030#include "fvec.h"
    31 #include "mathutils.h"
    3231
    3332#define MAX_CHANNELS 6
     
    8786 
    8887  s->scratch_size = s->hop_size*s->input_channels;
    89   s->scratch_data = AUBIO_ARRAY(float,s->scratch_size);
    90 
    9188  /* allocate data for de/interleaving reallocated when needed. */
    9289  if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {
    93     AUBIO_ERR("%d exceeds maximum aubio_source_sndfile buffer size %d\n", s->scratch_size, MAX_CHANNELS * MAX_CHANNELS);
     90    AUBIO_ERR("%d x %d exceeds maximum aubio_source_sndfile buffer size %d\n",
     91        s->hop_size, s->input_channels, MAX_CHANNELS * MAX_CHANNELS);
    9492    return NULL;
    9593  }
     94  s->scratch_data = AUBIO_ARRAY(float,s->scratch_size);
    9695
    9796  return s;
     
    102101  int i,j, input_channels = s->input_channels;
    103102  int aread;
    104   smpl_t *pread;       
    105 
    106103  /* do actual reading */
    107104  read_frames = sf_read_float (s->handle, s->scratch_data, s->scratch_size);
Note: See TracChangeset for help on using the changeset viewer.