[pulseaudio-discuss] [PATCH] echo-cancel test: fix segfault if invalid AEC method is given and handle mem leaks due to open files

Maarten Bosmans mkbosmans at gmail.com
Wed Dec 21 13:17:19 PST 2011


Good work Peter,

I'd split this up into two separate patches, as the patch solves two
conceptually different issues, which just happen to be in the same
file.
(I'm sure at least Arun agrees with me here, as he has asked the same
many time already)

And the spelling fixes on the other hand could very well be more
gathered together in fewer, larger patches.

Maarten

2011/12/13 Peter Meerwald <pmeerw at pmeerw.net>:
> From: Peter Meerwald <p.meerwald at bct-electronic.com>
>
> ---
>  src/modules/echo-cancel/module-echo-cancel.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
> index 00cb2e3..96b652f 100644
> --- a/src/modules/echo-cancel/module-echo-cancel.c
> +++ b/src/modules/echo-cancel/module-echo-cancel.c
> @@ -1709,7 +1709,7 @@ int pa__init(pa_module*m) {
>         goto fail;
>     }
>
> -    if (init_common(ma, u, &source_ss, &source_map))
> +    if (init_common(ma, u, &source_ss, &source_map) < 0)
>         goto fail;
>
>     u->asyncmsgq = pa_asyncmsgq_new(0);
> @@ -2092,7 +2092,8 @@ int main(int argc, char* argv[]) {
>     source_ss.channels = DEFAULT_CHANNELS;
>     pa_channel_map_init_auto(&source_map, source_ss.channels, PA_CHANNEL_MAP_DEFAULT);
>
> -    init_common(ma, &u, &source_ss, &source_map);
> +    if (init_common(ma, &u, &source_ss, &source_map) < 0)
> +        goto fail;
>
>     if (!u.ec->init(u.core, u.ec, &source_ss, &source_map, &sink_ss, &sink_map, &u.blocksize,
>                      (argc > 4) ? argv[5] : NULL )) {
> @@ -2184,13 +2185,16 @@ int main(int argc, char* argv[]) {
>
>     u.ec->done(u.ec);
>
> -    fclose(u.captured_file);
> -    fclose(u.played_file);
> -    fclose(u.canceled_file);
> +out:
> +    if (u.captured_file)
> +        fclose(u.captured_file);
> +    if (u.played_file)
> +        fclose(u.played_file);
> +    if (u.canceled_file)
> +        fclose(u.canceled_file);
>     if (u.drift_file)
>         fclose(u.drift_file);
>
> -out:
>     pa_xfree(rdata);
>     pa_xfree(pdata);
>     pa_xfree(cdata);
> --
> 1.7.4.1
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


More information about the pulseaudio-discuss mailing list