Commit 53a485cd authored by Paul B Mahol's avatar Paul B Mahol

avfilter/af_afftfilt: fix memory leaks on error

parent 2174a315
...@@ -40,6 +40,7 @@ typedef struct AFFTFiltContext { ...@@ -40,6 +40,7 @@ typedef struct AFFTFiltContext {
FFTComplex **fft_data; FFTComplex **fft_data;
FFTComplex **fft_temp; FFTComplex **fft_temp;
int nb_exprs; int nb_exprs;
int channels;
int window_size; int window_size;
AVExpr **real; AVExpr **real;
AVExpr **imag; AVExpr **imag;
...@@ -129,6 +130,7 @@ static int config_input(AVFilterLink *inlink) ...@@ -129,6 +130,7 @@ static int config_input(AVFilterLink *inlink)
char *args; char *args;
const char *last_expr = "1"; const char *last_expr = "1";
s->channels = inlink->channels;
s->pts = AV_NOPTS_VALUE; s->pts = AV_NOPTS_VALUE;
s->fft_bits = av_log2(s->fft_size); s->fft_bits = av_log2(s->fft_size);
s->fft = av_fft_init(s->fft_bits, 0); s->fft = av_fft_init(s->fft_bits, 0);
...@@ -435,7 +437,7 @@ static av_cold void uninit(AVFilterContext *ctx) ...@@ -435,7 +437,7 @@ static av_cold void uninit(AVFilterContext *ctx)
av_fft_end(s->fft); av_fft_end(s->fft);
av_fft_end(s->ifft); av_fft_end(s->ifft);
for (i = 0; i < s->nb_exprs; i++) { for (i = 0; i < s->channels; i++) {
if (s->fft_data) if (s->fft_data)
av_freep(&s->fft_data[i]); av_freep(&s->fft_data[i]);
if (s->fft_temp) if (s->fft_temp)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment