# HG changeset patch # User reimar # Date 1236339553 0 # Node ID 54230bed6a344f7aacada551b73b02d8283d5867 # Parent 5de88e6e2494d6ebd90983db9f8bf10c4278c588 Use a single malloc to allocate space for the circular buffers. diff -r 5de88e6e2494 -r 54230bed6a34 libaf/af_resample.c --- a/libaf/af_resample.c Fri Mar 06 11:31:18 2009 +0000 +++ b/libaf/af_resample.c Fri Mar 06 11:39:13 2009 +0000 @@ -181,9 +181,7 @@ // 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 @@ // 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