Commit 0accedd
committed
math: fft: fix error path in mod_fft_multi_plan_new()
The error path of mod_fft_multi_plan_new() had two related bugs. With
num_ffts == 1 the temporary input buffer aliases the caller-provided
inb, but the err_free_buffer label freed plan->tmp_i32[0]
unconditionally, which would have released the caller's buffer. With
num_ffts == 3, a failure in the second or third fft_plan_common_new()
call only freed the shared scratch buffer and the bit-reverse table,
leaking the previously allocated fft_plan entries.
Collapse all error labels into a single err: that calls
mod_fft_multi_plan_free(). That helper already walks fft_plan[] (NULL
slots from the initial mod_zalloc() are no-ops in mod_free()) and only
frees tmp_i32[0] when num_ffts > 1, so both issues are handled in one
place.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>1 parent 462cfb5 commit 0accedd
1 file changed
Lines changed: 8 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 113 | | |
120 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| |||
0 commit comments