Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/math/fft/fft_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct fft_multi_plan *mod_fft_multi_plan_new(struct processing_module *mod, voi
plan->tmp_i32[0] = mod_balloc(mod, tmp_size);
if (!plan->tmp_i32[0]) {
comp_cl_err(mod->dev, "Failed to allocate FFT buffers");
goto err_free_bit_reverse;
goto err;
}

/* Set up buffers */
Expand All @@ -95,7 +95,7 @@ struct fft_multi_plan *mod_fft_multi_plan_new(struct processing_module *mod, voi
plan->tmp_o32[i],
plan->fft_size, 32);
if (!plan->fft_plan[i])
goto err_free_buffer;
goto err;

plan->fft_plan[i]->bit_reverse_idx = plan->bit_reverse_idx;
}
Expand All @@ -110,14 +110,13 @@ struct fft_multi_plan *mod_fft_multi_plan_new(struct processing_module *mod, voi
plan->fft_plan[0]->len);
return plan;

err_free_buffer:
mod_free(mod, plan->tmp_i32[0]);

err_free_bit_reverse:
mod_free(mod, plan->bit_reverse_idx);

err:
mod_free(mod, plan);
/* mod_fft_multi_plan_free() handles partial state safely:
* - fft_plan[i] entries left NULL by mod_zalloc are skipped by mod_free,
* - tmp_i32[0] is freed only when num_ffts > 1, so it does not free
* the caller-provided inb in the single-FFT case.
*/
mod_fft_multi_plan_free(mod, plan);
return NULL;
}

Expand Down
Loading