Re: [PATCH] gdbus: fix double free

Colin Wee <[email protected]> Mon, 7 Apr 2025 17:14:00 +0000
Newsgroups dev.linux.lists.connman
Message-ID <ehg3kw272e7gcdzeemgjzmshh4w5gbukthlj3x6ujqw36bdfgt@2jfktdasfcos>
Nice, Jussi! Glad we arrived at the same fix :)

-Colin

On Mon, Apr 07, 2025 at 02:44:47PM +0300, Jussi Laakkonen wrote:
> 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);
>