ref: af86999b99080634dc3a3579b6cae011840daeb3
parent: 6192ce7bd43b9c6820bc93bacdd1d098b6ed51d1
author: Paul Brossier <piem@piem.org>
date: Sat Jul 14 08:39:09 EDT 2012
src/io/source_sndfile.c: return NULL before trying to allocate memory, clean up
--- a/src/io/source_sndfile.c
+++ b/src/io/source_sndfile.c
@@ -28,7 +28,6 @@
#include "aubio_priv.h"
#include "source_sndfile.h"
#include "fvec.h"
-#include "mathutils.h"
#define MAX_CHANNELS 6
#define MAX_SIZE 4096
@@ -86,13 +85,13 @@
}
s->scratch_size = s->hop_size*s->input_channels;
- s->scratch_data = AUBIO_ARRAY(float,s->scratch_size);
-
/* allocate data for de/interleaving reallocated when needed. */
if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {
- AUBIO_ERR("%d exceeds maximum aubio_source_sndfile buffer size %d\n", s->scratch_size, MAX_CHANNELS * MAX_CHANNELS);
+ AUBIO_ERR("%d x %d exceeds maximum aubio_source_sndfile buffer size %d\n",
+ s->hop_size, s->input_channels, MAX_CHANNELS * MAX_CHANNELS);
return NULL;
}
+ s->scratch_data = AUBIO_ARRAY(float,s->scratch_size);
return s;
}
@@ -101,8 +100,6 @@
sf_count_t read_frames;
int i,j, input_channels = s->input_channels;
int aread;
- smpl_t *pread;
-
/* do actual reading */
read_frames = sf_read_float (s->handle, s->scratch_data, s->scratch_size);