[pulseaudio-discuss] [PATCH 1/2] module-equalizer-sink: use fftwf_free in all the right places

David Henningsson david.henningsson at canonical.com
Mon Dec 8 01:27:03 PST 2014


Thanks, pushed both patches.

On 2014-12-05 09:38, Jason Newton wrote:
> Several mallocs were made using fftwf_malloc and were erroneously freed by
> pa_xfree. This patch corrects these calls of pa_xfree to fftwf_free.
> ---
>   src/modules/module-equalizer-sink.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/src/modules/module-equalizer-sink.c b/src/modules/module-equalizer-sink.c
> index 811bbc2..3acca71 100644
> --- a/src/modules/module-equalizer-sink.c
> +++ b/src/modules/module-equalizer-sink.c
> @@ -232,7 +232,7 @@ static void alloc_input_buffers(struct userdata *u, size_t min_buffer_length) {
>           if (u->input[c]) {
>               if (!u->first_iteration)
>                   memcpy(tmp, u->input[c], u->overlap_size * sizeof(float));
> -            free(u->input[c]);
> +            fftwf_free(u->input[c]);
>           }
>           u->input[c] = tmp;
>       }
> @@ -1340,22 +1340,22 @@ void pa__done(pa_module*m) {
>
>       fftwf_destroy_plan(u->inverse_plan);
>       fftwf_destroy_plan(u->forward_plan);
> -    pa_xfree(u->output_window);
> +    fftwf_free(u->output_window);
>       for (c = 0; c < u->channels; ++c) {
>           pa_aupdate_free(u->a_H[c]);
> -        pa_xfree(u->overlap_accum[c]);
> -        pa_xfree(u->input[c]);
> +        fftwf_free(u->overlap_accum[c]);
> +        fftwf_free(u->input[c]);
>       }
>       pa_xfree(u->a_H);
>       pa_xfree(u->overlap_accum);
>       pa_xfree(u->input);
> -    pa_xfree(u->work_buffer);
> -    pa_xfree(u->W);
> +    fftwf_free(u->work_buffer);
> +    fftwf_free(u->W);
>       for (c = 0; c < u->channels; ++c) {
>           pa_xfree(u->Xs[c]);
>           for (size_t i = 0; i < 2; ++i)
> -            pa_xfree(u->Hs[c][i]);
> -        pa_xfree(u->Hs[c]);
> +            fftwf_free(u->Hs[c][i]);
> +        fftwf_free(u->Hs[c]);
>       }
>       pa_xfree(u->Xs);
>       pa_xfree(u->Hs);
>

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list