Re: [PATCH] gdbus: fix double free

Jussi Laakkonen <[email protected]> Mon, 7 Apr 2025 14:44:47 +0300
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
Hi Colin,

+1 for this, it was also found by Clang analyzer, I forgot to push my 
finding on this here 
https://github.com/sailfishos/connman/commit/6aa2c2910edc2186233da64726d4afa0c17aa5b3

Cheers,
  Jussi

On 4/5/25 05:09, Colin Wee wrote:
> These are freed later in filter_data_free.
> 
> Signed-off-by: Colin Wee <[email protected]>
> ---
>   gdbus/watch.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/gdbus/watch.c b/gdbus/watch.c
> index 8fa76cda..5cb2167e 100644
> --- a/gdbus/watch.c
> +++ b/gdbus/watch.c
> @@ -332,7 +332,6 @@ static void filter_data_call_and_free(struct filter_data *data)
>   			cb->disc_func(data->connection, cb->user_data);
>   		if (cb->destroy_func)
>   			cb->destroy_func(cb->user_data);
> -		g_free(cb);
>   	}
>   
>   	filter_data_free(data);