2010-07-26 01:11:11

by Zhenhua Zhang

[permalink] [raw]
Subject: [PATCH v2] watch: Free service data in service_reply

Avoid the memory leak of server_data.
---
gdbus/watch.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gdbus/watch.c b/gdbus/watch.c
index 1d479fa..29f23e2 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -533,7 +533,7 @@ static void check_service(DBusConnection *connection, const char *name,
goto done;
}

- dbus_pending_call_set_notify(call, service_reply, data, NULL);
+ dbus_pending_call_set_notify(call, service_reply, data, g_free);

dbus_pending_call_unref(call);

--
1.7.0.4



2010-07-26 09:38:06

by Zhenhua Zhang

[permalink] [raw]
Subject: RE: [PATCH v2] watch: Free service data in service_reply

Hi Johan,

Johan Hedberg wrote:
> Hi,
>
> On Mon, Jul 26, 2010, Zhenhua Zhang wrote:
>> Avoid the memory leak of server_data.
>> ---
>> gdbus/watch.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/gdbus/watch.c b/gdbus/watch.c
>> index 1d479fa..29f23e2 100644
>> --- a/gdbus/watch.c
>> +++ b/gdbus/watch.c
>> @@ -533,7 +533,7 @@ static void check_service(DBusConnection
>> *connection, const char *name, goto done; }
>>
>> - dbus_pending_call_set_notify(call, service_reply, data, NULL);
>> + dbus_pending_call_set_notify(call, service_reply, data, g_free);
>>
>> dbus_pending_call_unref(call);
>
> Thanks for the updated patch. It has now been pushed both to bluez and
> obexd upstream trees with a fixed commit message (e.g. your summary
> line was not truthful anymore since the data isn't being freed in
> service_reply but by libdbus itself.
>
> Johan

Thanks. Will pay attention to the commit title next time.

Regards,
Zhenhua

2010-07-26 09:33:54

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH v2] watch: Free service data in service_reply

Hi,

On Mon, Jul 26, 2010, Zhenhua Zhang wrote:
> Avoid the memory leak of server_data.
> ---
> gdbus/watch.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/gdbus/watch.c b/gdbus/watch.c
> index 1d479fa..29f23e2 100644
> --- a/gdbus/watch.c
> +++ b/gdbus/watch.c
> @@ -533,7 +533,7 @@ static void check_service(DBusConnection *connection, const char *name,
> goto done;
> }
>
> - dbus_pending_call_set_notify(call, service_reply, data, NULL);
> + dbus_pending_call_set_notify(call, service_reply, data, g_free);
>
> dbus_pending_call_unref(call);

Thanks for the updated patch. It has now been pushed both to bluez and
obexd upstream trees with a fixed commit message (e.g. your summary line
was not truthful anymore since the data isn't being freed in
service_reply but by libdbus itself.

Johan