mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
filter-chain: clean up on errors
This commit is contained in:
parent
1b88e0023b
commit
cf66400035
1 changed files with 17 additions and 8 deletions
|
|
@ -181,14 +181,14 @@ static struct convolver1 *convolver1_new(int block, const float *ir, int irlen)
|
||||||
|
|
||||||
conv->fft = fft_new(conv->segSize);
|
conv->fft = fft_new(conv->segSize);
|
||||||
if (conv->fft == NULL)
|
if (conv->fft == NULL)
|
||||||
return NULL;
|
goto error;
|
||||||
conv->ifft = ifft_new(conv->segSize);
|
conv->ifft = ifft_new(conv->segSize);
|
||||||
if (conv->ifft == NULL)
|
if (conv->ifft == NULL)
|
||||||
return NULL;
|
goto error;
|
||||||
|
|
||||||
conv->fft_buffer = fft_alloc(conv->segSize);
|
conv->fft_buffer = fft_alloc(conv->segSize);
|
||||||
if (conv->fft_buffer == NULL)
|
if (conv->fft_buffer == NULL)
|
||||||
return NULL;
|
goto error;
|
||||||
|
|
||||||
conv->segments = calloc(sizeof(struct fft_cpx), conv->segCount);
|
conv->segments = calloc(sizeof(struct fft_cpx), conv->segCount);
|
||||||
conv->segmentsIr = calloc(sizeof(struct fft_cpx), conv->segCount);
|
conv->segmentsIr = calloc(sizeof(struct fft_cpx), conv->segCount);
|
||||||
|
|
@ -214,6 +214,15 @@ static struct convolver1 *convolver1_new(int block, const float *ir, int irlen)
|
||||||
convolver1_reset(conv);
|
convolver1_reset(conv);
|
||||||
|
|
||||||
return conv;
|
return conv;
|
||||||
|
error:
|
||||||
|
if (conv->fft)
|
||||||
|
fft_destroy(conv->fft);
|
||||||
|
if (conv->ifft)
|
||||||
|
fft_destroy(conv->ifft);
|
||||||
|
if (conv->fft_buffer)
|
||||||
|
fft_free(conv->fft_buffer);
|
||||||
|
free(conv);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convolver1_free(struct convolver1 *conv)
|
static void convolver1_free(struct convolver1 *conv)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue