[pulseaudio-discuss] [PATCH 06/23] echo-cancel: Fix memory leak / deinitialization of Adrian AEC

Tanu Kaskinen tanuk at iki.fi
Thu Feb 14 06:24:17 PST 2013


On Wed, 2013-02-13 at 17:26 +0100, Peter Meerwald wrote:
> From: Peter Meerwald <p.meerwald at bct-electronic.com>
> 
> was simply absent
> 
> Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>
> ---
>  src/modules/echo-cancel/adrian-aec.c |   11 +++++++++++
>  src/modules/echo-cancel/adrian-aec.h |    3 ++-
>  src/modules/echo-cancel/adrian.c     |    6 ++++--
>  src/modules/echo-cancel/adrian.h     |    1 +
>  4 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/src/modules/echo-cancel/adrian-aec.c b/src/modules/echo-cancel/adrian-aec.c
> index 1476ee4..9134212 100644
> --- a/src/modules/echo-cancel/adrian-aec.c
> +++ b/src/modules/echo-cancel/adrian-aec.c
> @@ -106,6 +106,17 @@ AEC* AEC_init(int RATE, int have_vector)
>    return a;
>  }
>  
> +void AEC_done(AEC *a) {
> +    if (a) {

The convention is to not allow NULL to be passed to free functions
(pa_xfree() being an exception). I replaced this if with an assertion.

> +        pa_xfree(a->Fx);
> +        pa_xfree(a->Fe);
> +        pa_xfree(a->acMic);
> +        pa_xfree(a->acSpk);
> +        pa_xfree(a->cutoff);

I don't understand why these are allocated from the heap, but that's not
your problem...

> diff --git a/src/modules/echo-cancel/adrian.h b/src/modules/echo-cancel/adrian.h
> index 639fa9e..4ace392 100644
> --- a/src/modules/echo-cancel/adrian.h
> +++ b/src/modules/echo-cancel/adrian.h
> @@ -28,4 +28,5 @@
>  typedef struct AEC AEC;
>  
>  AEC* AEC_init(int RATE, int have_vector);
> +void AEC_done(AEC *a);
>  int AEC_doAEC(AEC *a, int d_, int x_);

This seems pretty pointless header (duplicates adrian-aec.h), but again
not your problem.

-- 
Tanu



More information about the pulseaudio-discuss mailing list