* [PATCH 1/3] Fix dbus reply memory leak
@ 2011-11-24 14:14 Syam Sidhardhan
2011-11-24 14:14 ` [PATCH 2/3] Remove unwanted GError* assignment to NULL Syam Sidhardhan
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Syam Sidhardhan @ 2011-11-24 14:14 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Syam Sidhardhan
---
audio/telephony-maemo5.c | 8 ++++----
cups/main.c | 30 +++++++++++++++++++++++++-----
test/agent.c | 2 ++
test/mpris-player.c | 6 +++++-
4 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/audio/telephony-maemo5.c b/audio/telephony-maemo5.c
index 23801c0..2832062 100644
--- a/audio/telephony-maemo5.c
+++ b/audio/telephony-maemo5.c
@@ -1599,12 +1599,12 @@ static void signal_strength_reply(DBusPendingCall *call, void *user_data)
error("Unable to parse signal_strength reply: %s, %s",
err.name, err.message);
dbus_error_free(&err);
- return;
+ goto done;
}
if (net_err != 0) {
error("get_signal_strength failed with code %d", net_err);
- return;
+ goto done;
}
update_signal_strength(signals_bar);
@@ -1654,12 +1654,12 @@ static void registration_status_reply(DBusPendingCall *call, void *user_data)
error("Unable to parse registration_status_change reply:"
" %s, %s", err.name, err.message);
dbus_error_free(&err);
- return;
+ goto done;
}
if (net_err != 0) {
error("get_registration_status failed with code %d", net_err);
- return;
+ goto done;
}
update_registration_status(status, lac, cell_id, operator_code,
diff --git a/cups/main.c b/cups/main.c
index 7f3f4b0..a884c6e 100644
--- a/cups/main.c
+++ b/cups/main.c
@@ -348,10 +348,15 @@ static void remote_device_found(const char *adapter, const char *bdaddr,
dbus_message_unref(message);
+ if (!adapter_reply)
+ return;
+
if (dbus_message_get_args(adapter_reply, NULL,
DBUS_TYPE_OBJECT_PATH, &adapter,
- DBUS_TYPE_INVALID) == FALSE)
+ DBUS_TYPE_INVALID) == FALSE) {
+ dbus_message_unref(adapter_reply);
return;
+ }
}
message = dbus_message_new_method_call("org.bluez", adapter,
@@ -386,12 +391,16 @@ static void remote_device_found(const char *adapter, const char *bdaddr,
if (dbus_message_get_args(reply, NULL,
DBUS_TYPE_OBJECT_PATH, &object_path,
- DBUS_TYPE_INVALID) == FALSE)
+ DBUS_TYPE_INVALID) == FALSE) {
+ dbus_message_unref(reply);
return;
+ }
id = device_get_ieee1284_id(adapter, object_path);
add_device_to_list(name, bdaddr, id);
g_free(id);
+
+ dbus_message_unref(reply);
}
static void discovery_completed(void)
@@ -642,10 +651,15 @@ static gboolean print_ieee1284(const char *bdaddr)
dbus_message_unref(message);
+ if (!adapter_reply)
+ return FALSE;
+
if (dbus_message_get_args(adapter_reply, NULL,
DBUS_TYPE_OBJECT_PATH, &adapter,
- DBUS_TYPE_INVALID) == FALSE)
+ DBUS_TYPE_INVALID) == FALSE) {
+ dbus_message_unref(adapter_reply);
return FALSE;
+ }
message = dbus_message_new_method_call("org.bluez", adapter,
"org.bluez.Adapter",
@@ -680,15 +694,21 @@ static gboolean print_ieee1284(const char *bdaddr)
if (dbus_message_get_args(reply, NULL,
DBUS_TYPE_OBJECT_PATH, &object_path,
- DBUS_TYPE_INVALID) == FALSE)
+ DBUS_TYPE_INVALID) == FALSE) {
+ dbus_message_unref(reply);
return FALSE;
+ }
id = device_get_ieee1284_id(adapter, object_path);
- if (id == NULL)
+ if (id == NULL) {
+ dbus_message_unref(reply);
return FALSE;
+ }
printf("%s", id);
g_free(id);
+ dbus_message_unref(reply);
+
return TRUE;
}
diff --git a/test/agent.c b/test/agent.c
index ae74074..5cdeeb4 100644
--- a/test/agent.c
+++ b/test/agent.c
@@ -504,6 +504,7 @@ static char *get_default_adapter_path(DBusConnection *conn)
fprintf(stderr, "%s\n", err.message);
dbus_error_free(&err);
}
+ dbus_message_unref(reply);
return NULL;
}
@@ -562,6 +563,7 @@ static char *get_adapter_path(DBusConnection *conn, const char *adapter)
fprintf(stderr, "%s\n", err.message);
dbus_error_free(&err);
}
+ dbus_message_unref(reply);
return NULL;
}
diff --git a/test/mpris-player.c b/test/mpris-player.c
index a1632f3..a2c4cc6 100644
--- a/test/mpris-player.c
+++ b/test/mpris-player.c
@@ -700,6 +700,7 @@ static char *get_default_adapter(DBusConnection *conn)
fprintf(stderr, "%s\n", err.message);
dbus_error_free(&err);
}
+ dbus_message_unref(reply);
return NULL;
}
@@ -756,6 +757,7 @@ static char *get_adapter(DBusConnection *conn, const char *adapter)
fprintf(stderr, "%s\n", err.message);
dbus_error_free(&err);
}
+ dbus_message_unref(reply);
return NULL;
}
@@ -802,8 +804,10 @@ static char *get_name_owner(DBusConnection *conn, const char *name)
if (!dbus_message_get_args(reply, NULL,
DBUS_TYPE_STRING, &owner,
- DBUS_TYPE_INVALID))
+ DBUS_TYPE_INVALID)) {
+ dbus_message_unref(reply);
return NULL;
+ }
owner = g_strdup(owner);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/3] Remove unwanted GError* assignment to NULL
2011-11-24 14:14 [PATCH 1/3] Fix dbus reply memory leak Syam Sidhardhan
@ 2011-11-24 14:14 ` Syam Sidhardhan
2011-12-02 11:18 ` Johan Hedberg
2011-11-24 14:14 ` [PATCH 3/3] Send the Extended Error result code, if requested in the failure cases Syam Sidhardhan
2011-12-02 11:15 ` [PATCH 1/3] Fix dbus reply memory leak Johan Hedberg
2 siblings, 1 reply; 11+ messages in thread
From: Syam Sidhardhan @ 2011-11-24 14:14 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Syam Sidhardhan
---
health/hdp.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/health/hdp.c b/health/hdp.c
index d167ab0..403d4c8 100644
--- a/health/hdp.c
+++ b/health/hdp.c
@@ -551,7 +551,6 @@ static void hdp_get_dcpsm_cb(uint16_t dcpsm, gpointer user_data, GError *err)
hdp_tmp_dc_data_unref(hdp_conn);
hdp_conn->cb(hdp_chann->mdl, err, hdp_conn);
g_error_free(gerr);
- gerr = NULL;
}
static void device_reconnect_mdl_cb(struct mcap_mdl *mdl, GError *err,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] Send the Extended Error result code, if requested in the failure cases
2011-11-24 14:14 [PATCH 1/3] Fix dbus reply memory leak Syam Sidhardhan
2011-11-24 14:14 ` [PATCH 2/3] Remove unwanted GError* assignment to NULL Syam Sidhardhan
@ 2011-11-24 14:14 ` Syam Sidhardhan
2011-11-24 15:16 ` Syam Sidhardhan
2011-12-02 11:15 ` [PATCH 1/3] Fix dbus reply memory leak Johan Hedberg
2 siblings, 1 reply; 11+ messages in thread
From: Syam Sidhardhan @ 2011-11-24 14:14 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Syam Sidhardhan
If HF has already requested for the Extended Error result code reporting,
then send the same in certain failure cases. Earlier in this case we were
sending normal Error.
---
audio/headset.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/audio/headset.c b/audio/headset.c
index 6aef6a8..2bddedc 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -1331,7 +1331,13 @@ static gboolean rfcomm_io_cb(GIOChannel *chan, GIOCondition cond,
if (err == -EINVAL) {
error("Badly formated or unrecognized command: %s",
&slc->buf[slc->data_start]);
- err = headset_send(hs, "\r\nERROR\r\n");
+
+ if (slc->enabled)
+ err = headset_send(hs, "\r\n+CME ERROR: %d\r\n",
+ CME_ERROR_NOT_SUPPORTED);
+ else
+ err = headset_send(hs, "\r\nERROR\r\n");
+
if (err < 0)
goto failed;
} else if (err < 0)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] Send the Extended Error result code, if requested in the failure cases
2011-11-24 14:14 ` [PATCH 3/3] Send the Extended Error result code, if requested in the failure cases Syam Sidhardhan
@ 2011-11-24 15:16 ` Syam Sidhardhan
0 siblings, 0 replies; 11+ messages in thread
From: Syam Sidhardhan @ 2011-11-24 15:16 UTC (permalink / raw)
To: Syam Sidhardhan, linux-bluetooth
Hi,
----- Original Message -----
From: "Syam Sidhardhan" <s.syam@samsung.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: "Syam Sidhardhan" <s.syam@samsung.com>
Sent: Thursday, November 24, 2011 7:44 PM
Subject: [PATCH 3/3] Send the Extended Error result code, if requested in
the failure cases
> If HF has already requested for the Extended Error result code reporting,
> then send the same in certain failure cases. Earlier in this case we were
> sending normal Error.
> ---
> audio/headset.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/audio/headset.c b/audio/headset.c
> index 6aef6a8..2bddedc 100644
> --- a/audio/headset.c
> +++ b/audio/headset.c
> @@ -1331,7 +1331,13 @@ static gboolean rfcomm_io_cb(GIOChannel *chan,
> GIOCondition cond,
> if (err == -EINVAL) {
> error("Badly formated or unrecognized command: %s",
> &slc->buf[slc->data_start]);
> - err = headset_send(hs, "\r\nERROR\r\n");
> +
> + if (slc->enabled)
> + err = headset_send(hs, "\r\n+CME ERROR: %d\r\n",
> + CME_ERROR_NOT_SUPPORTED);
> + else
> + err = headset_send(hs, "\r\nERROR\r\n");
> +
> if (err < 0)
> goto failed;
> } else if (err < 0)
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Kindly ignore this patch. Its should be if (slc->cme_enabled). Sorry, By
mistake got posted before correcting.
Also I want to distinguish CME error message in the case of invalid AT
commands and parse error(eg AT+CMER ).
Both case handle_event() returns -EINVAL.
Regards,
Syam.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] Fix dbus reply memory leak
2011-11-24 14:14 [PATCH 1/3] Fix dbus reply memory leak Syam Sidhardhan
2011-11-24 14:14 ` [PATCH 2/3] Remove unwanted GError* assignment to NULL Syam Sidhardhan
2011-11-24 14:14 ` [PATCH 3/3] Send the Extended Error result code, if requested in the failure cases Syam Sidhardhan
@ 2011-12-02 11:15 ` Johan Hedberg
2011-12-03 20:25 ` Syam Sidhardhan
2 siblings, 1 reply; 11+ messages in thread
From: Johan Hedberg @ 2011-12-02 11:15 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: linux-bluetooth
Hi Syam,
On Thu, Nov 24, 2011, Syam Sidhardhan wrote:
> ---
> audio/telephony-maemo5.c | 8 ++++----
> cups/main.c | 30 +++++++++++++++++++++++++-----
> test/agent.c | 2 ++
> test/mpris-player.c | 6 +++++-
> 4 files changed, 36 insertions(+), 10 deletions(-)
Your commit message uses the word leak in singular form but there are
multiple fixes in this patch, i.e. the commit message is misleading. In
this case I'd split the patch into four separate ones:
telephony-maemo5: Fix D-Bus reply memory leaks
cups: Fix D-Bus reply memory leaks
agent: Fix D-Bus reply memory leaks
mpris-player: Fix D-Bus reply memory leaks
Johan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] Remove unwanted GError* assignment to NULL
2011-11-24 14:14 ` [PATCH 2/3] Remove unwanted GError* assignment to NULL Syam Sidhardhan
@ 2011-12-02 11:18 ` Johan Hedberg
2011-12-02 11:25 ` Santiago Carot
0 siblings, 1 reply; 11+ messages in thread
From: Johan Hedberg @ 2011-12-02 11:18 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: linux-bluetooth
Hi Syam,
On Thu, Nov 24, 2011, Syam Sidhardhan wrote:
> ---
> health/hdp.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/health/hdp.c b/health/hdp.c
> index d167ab0..403d4c8 100644
> --- a/health/hdp.c
> +++ b/health/hdp.c
> @@ -551,7 +551,6 @@ static void hdp_get_dcpsm_cb(uint16_t dcpsm, gpointer user_data, GError *err)
> hdp_tmp_dc_data_unref(hdp_conn);
> hdp_conn->cb(hdp_chann->mdl, err, hdp_conn);
> g_error_free(gerr);
> - gerr = NULL;
> }
Applied, however a bigger question is whether gerr is even needed in
this function at all since it's never used after potentially being set.
Johan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] Remove unwanted GError* assignment to NULL
2011-12-02 11:18 ` Johan Hedberg
@ 2011-12-02 11:25 ` Santiago Carot
0 siblings, 0 replies; 11+ messages in thread
From: Santiago Carot @ 2011-12-02 11:25 UTC (permalink / raw)
To: Syam Sidhardhan, linux-bluetooth
Hi,
2011/12/2 Johan Hedberg <johan.hedberg@gmail.com>:
> Hi Syam,
>
> On Thu, Nov 24, 2011, Syam Sidhardhan wrote:
>> ---
>> health/hdp.c | 1 -
>> 1 files changed, 0 insertions(+), 1 deletions(-)
>>
>> diff --git a/health/hdp.c b/health/hdp.c
>> index d167ab0..403d4c8 100644
>> --- a/health/hdp.c
>> +++ b/health/hdp.c
>> @@ -551,7 +551,6 @@ static void hdp_get_dcpsm_cb(uint16_t dcpsm, gpointer user_data, GError *err)
>> hdp_tmp_dc_data_unref(hdp_conn);
>> hdp_conn->cb(hdp_chann->mdl, err, hdp_conn);
>> g_error_free(gerr);
>> - gerr = NULL;
>> }
>
> Applied, however a bigger question is whether gerr is even needed in
> this function at all since it's never used after potentially being set.
>
I think it would be better get ride of it at least we can add a debug
message here if MCAP fails trying to connect the data channel.
Regards.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] Fix dbus reply memory leak
2011-12-02 11:15 ` [PATCH 1/3] Fix dbus reply memory leak Johan Hedberg
@ 2011-12-03 20:25 ` Syam Sidhardhan
2011-12-03 21:00 ` gene heskett
2011-12-04 20:55 ` Johan Hedberg
0 siblings, 2 replies; 11+ messages in thread
From: Syam Sidhardhan @ 2011-12-03 20:25 UTC (permalink / raw)
To: Syam Sidhardhan, linux-bluetooth
Hi Johan,
On 12/2/2011 4:45 PM, Johan Hedberg wrote:
> Hi Syam,
>
> On Thu, Nov 24, 2011, Syam Sidhardhan wrote:
>
>> ---
>> audio/telephony-maemo5.c | 8 ++++----
>> cups/main.c | 30 +++++++++++++++++++++++++-----
>> test/agent.c | 2 ++
>> test/mpris-player.c | 6 +++++-
>> 4 files changed, 36 insertions(+), 10 deletions(-)
>>
> Your commit message uses the word leak in singular form but there are
> multiple fixes in this patch, i.e. the commit message is misleading. In
> this case I'd split the patch into four separate ones:
>
> telephony-maemo5: Fix D-Bus reply memory leaks
> cups: Fix D-Bus reply memory leaks
> agent: Fix D-Bus reply memory leaks
> mpris-player: Fix D-Bus reply memory leaks
>
> Johan
>
Yes, you are correct. You can split it into multiple patches.
Thanks in advance.
Syam
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] Fix dbus reply memory leak
2011-12-03 20:25 ` Syam Sidhardhan
@ 2011-12-03 21:00 ` gene heskett
2011-12-04 20:55 ` Johan Hedberg
1 sibling, 0 replies; 11+ messages in thread
From: gene heskett @ 2011-12-03 21:00 UTC (permalink / raw)
To: linux-bluetooth
On Saturday, December 03, 2011 03:54:56 PM Syam Sidhardhan did opine:
> Hi Johan,
>
> On 12/2/2011 4:45 PM, Johan Hedberg wrote:
> > Hi Syam,
> >
> > On Thu, Nov 24, 2011, Syam Sidhardhan wrote:
> >> ---
> >>
> >> audio/telephony-maemo5.c | 8 ++++----
> >> cups/main.c | 30 +++++++++++++++++++++++++-----
> >> test/agent.c | 2 ++
> >> test/mpris-player.c | 6 +++++-
> >> 4 files changed, 36 insertions(+), 10 deletions(-)
> >
> > Your commit message uses the word leak in singular form but there are
> > multiple fixes in this patch, i.e. the commit message is misleading.
> > In this case I'd split the patch into four separate ones:
> >
> > telephony-maemo5: Fix D-Bus reply memory leaks
> > cups: Fix D-Bus reply memory leaks
> > agent: Fix D-Bus reply memory leaks
> > mpris-player: Fix D-Bus reply memory leaks
> >
> > Johan
>
> Yes, you are correct. You can split it into multiple patches.
> Thanks in advance.
>
> Syam
Probably off topic to this patch discussion, but whats chances, while you
folks are kicking dbus's tires, of fixing the thing so that if the target
doesn't exist, the message sent gets thrown under the buss instead of
blocking, which then requires a kill of both processes, and a proper
sequentially done restart (target started first) to make it work?
Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene>
I am just a nice, clean-cut Mongolian boy.
-- Yul Brynner, 1956
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] Fix dbus reply memory leak
2011-12-03 20:25 ` Syam Sidhardhan
2011-12-03 21:00 ` gene heskett
@ 2011-12-04 20:55 ` Johan Hedberg
2011-12-05 15:20 ` Syam Sidhardhan
1 sibling, 1 reply; 11+ messages in thread
From: Johan Hedberg @ 2011-12-04 20:55 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: Syam Sidhardhan, linux-bluetooth
Hi Syam,
On Sun, Dec 04, 2011, Syam Sidhardhan wrote:
> >Your commit message uses the word leak in singular form but there are
> >multiple fixes in this patch, i.e. the commit message is misleading. In
> >this case I'd split the patch into four separate ones:
> >
> >telephony-maemo5: Fix D-Bus reply memory leaks
> >cups: Fix D-Bus reply memory leaks
> >agent: Fix D-Bus reply memory leaks
> >mpris-player: Fix D-Bus reply memory leaks
> >
> >Johan
>
> Yes, you are correct. You can split it into multiple patches.
> Thanks in advance.
Maybe I was a bit unclear: I'm expecting *you* to do this split and
resend the patches. Thanks :)
Johan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] Fix dbus reply memory leak
2011-12-04 20:55 ` Johan Hedberg
@ 2011-12-05 15:20 ` Syam Sidhardhan
0 siblings, 0 replies; 11+ messages in thread
From: Syam Sidhardhan @ 2011-12-05 15:20 UTC (permalink / raw)
To: Johan Hedberg, Syam Sidhardhan; +Cc: linux-bluetooth
Hi Johan,
----- Original Message -----
From: "Johan Hedberg" <johan.hedberg@gmail.com>
To: "Syam Sidhardhan" <syamsidhardh@gmail.com>
Cc: "Syam Sidhardhan" <s.syam@samsung.com>;
<linux-bluetooth@vger.kernel.org>
Sent: Monday, December 05, 2011 2:25 AM
Subject: Re: [PATCH 1/3] Fix dbus reply memory leak
> Hi Syam,
>
> On Sun, Dec 04, 2011, Syam Sidhardhan wrote:
>> >Your commit message uses the word leak in singular form but there are
>> >multiple fixes in this patch, i.e. the commit message is misleading. In
>> >this case I'd split the patch into four separate ones:
>> >
>> >telephony-maemo5: Fix D-Bus reply memory leaks
>> >cups: Fix D-Bus reply memory leaks
>> >agent: Fix D-Bus reply memory leaks
>> >mpris-player: Fix D-Bus reply memory leaks
>> >
>> >Johan
>>
>> Yes, you are correct. You can split it into multiple patches.
>> Thanks in advance.
>
> Maybe I was a bit unclear: I'm expecting *you* to do this split and
> resend the patches. Thanks :)
>
> Johan
Ok :-),
I'll split it and send.
Regadrs,
Syam
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-12-05 15:20 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24 14:14 [PATCH 1/3] Fix dbus reply memory leak Syam Sidhardhan
2011-11-24 14:14 ` [PATCH 2/3] Remove unwanted GError* assignment to NULL Syam Sidhardhan
2011-12-02 11:18 ` Johan Hedberg
2011-12-02 11:25 ` Santiago Carot
2011-11-24 14:14 ` [PATCH 3/3] Send the Extended Error result code, if requested in the failure cases Syam Sidhardhan
2011-11-24 15:16 ` Syam Sidhardhan
2011-12-02 11:15 ` [PATCH 1/3] Fix dbus reply memory leak Johan Hedberg
2011-12-03 20:25 ` Syam Sidhardhan
2011-12-03 21:00 ` gene heskett
2011-12-04 20:55 ` Johan Hedberg
2011-12-05 15:20 ` Syam Sidhardhan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.