[pulseaudio-discuss] [PATCH] filter-apply: Fixed memory leak.
Georg Chini
georg at chini.tk
Wed Apr 12 09:48:24 UTC 2017
On 07.04.2017 16:28, KimJeongYeon wrote:
> 'fltr->name' should free prior to free 'fltr'.
>
> Signed-off-by: KimJeongYeon <jeongyeon.kim at samsung.com>
> ---
> src/modules/module-filter-apply.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c
> index f7e8734..e2a3ec8 100644
> --- a/src/modules/module-filter-apply.c
> +++ b/src/modules/module-filter-apply.c
> @@ -514,7 +514,10 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, process_cmd_ty
>
> done:
> pa_xfree(module_name);
> - pa_xfree(fltr);
> + if (fltr) {
> + pa_xfree(fltr->name);
> + pa_xfree(fltr);
> + }
>
> return PA_HOOK_OK;
> }
I think you can modify the filter_free() function instead and then use
it here.
There is an assert(f) in that function that can safely be removed because
there is no way the function could be called from other places without f
set.
(There is only one place where it would not already break before the
filter_free()
call and in that place it is checked before the call that filter is not
NULL)
Something else: Would you mind if I correct your grammar/spelling when
pushing the commits? It might be faster than asking you to do it.
Regards
Georg
More information about the pulseaudio-discuss
mailing list