From 33ca05bce930b4d5fa34b735f4edc61d52bcfa1a Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 6 Mar 2009 11:39:13 +0000 Subject: Use a single malloc to allocate space for the circular buffers. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28845 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libaf/af_resample.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'libaf') diff --git a/libaf/af_resample.c b/libaf/af_resample.c index ea628c7ae8..3698806fd5 100644 --- a/libaf/af_resample.c +++ b/libaf/af_resample.c @@ -181,9 +181,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg) // Free space for circular buffers if(s->xq){ - for(i=1;idata->nch;i++) - if(s->xq[i]) - free(s->xq[i]); + free(s->xq[0]); free(s->xq); s->xq = NULL; } @@ -218,8 +216,9 @@ static int control(struct af_instance_s* af, int cmd, void* arg) // Create space for circular buffers s->xq = malloc(n->nch*sizeof(void*)); - for(i=0;inch;i++) - s->xq[i] = malloc(2*L*af->data->bps); + s->xq[0] = malloc(n->nch*2*L*af->data->bps); + for(i=1;inch;i++) + s->xq[i] = (uint8_t *)s->xq[i-1] + 2*L*af->data->bps; s->xi = 0; // Check if the design needs to be redone -- cgit v1.2.3