* [PATCH] android/handsfree: Check service class is not zero
@ 2014-03-13 12:31 Andrei Emeltchenko
2014-03-27 20:48 ` Szymon Janc
0 siblings, 1 reply; 2+ messages in thread
From: Andrei Emeltchenko @ 2014-03-13 12:31 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Fixes static analyzers NULL dereference warnings. The similar check is
done in src/device.c in line 2959.
---
android/handsfree.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/android/handsfree.c b/android/handsfree.c
index b71c28e..7167938 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
@@ -1152,6 +1152,9 @@ static void sdp_hsp_search_cb(sdp_list_t *recs, int err, gpointer data)
goto fail;
}
+ if (!classes)
+ goto fail;
+
if (sdp_get_access_protos(recs->data, &protos) < 0) {
error("handsfree: unable to get access protocols from record");
sdp_list_free(classes, free);
@@ -1242,6 +1245,9 @@ static void sdp_hfp_search_cb(sdp_list_t *recs, int err, gpointer data)
goto fail;
}
+ if (!classes)
+ goto fail;
+
if (sdp_get_access_protos(recs->data, &protos) < 0) {
error("handsfree: unable to get access protocols from record");
sdp_list_free(classes, free);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] android/handsfree: Check service class is not zero
2014-03-13 12:31 [PATCH] android/handsfree: Check service class is not zero Andrei Emeltchenko
@ 2014-03-27 20:48 ` Szymon Janc
0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-03-27 20:48 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
Hi Andrei,
On Thursday 13 March 2014 14:31:57 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Fixes static analyzers NULL dereference warnings. The similar check is
> done in src/device.c in line 2959.
> ---
> android/handsfree.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/android/handsfree.c b/android/handsfree.c
> index b71c28e..7167938 100644
> --- a/android/handsfree.c
> +++ b/android/handsfree.c
> @@ -1152,6 +1152,9 @@ static void sdp_hsp_search_cb(sdp_list_t *recs, int
> err, gpointer data) goto fail;
> }
>
> + if (!classes)
> + goto fail;
> +
> if (sdp_get_access_protos(recs->data, &protos) < 0) {
> error("handsfree: unable to get access protocols from record");
> sdp_list_free(classes, free);
> @@ -1242,6 +1245,9 @@ static void sdp_hfp_search_cb(sdp_list_t *recs, int
> err, gpointer data) goto fail;
> }
>
> + if (!classes)
> + goto fail;
> +
> if (sdp_get_access_protos(recs->data, &protos) < 0) {
> error("handsfree: unable to get access protocols from record");
> sdp_list_free(classes, free);
Applied with some modifications so that we log error in case classes are NULL.
Thanks.
--
Szymon K. Janc
szymon.janc@gmail.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-27 20:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-13 12:31 [PATCH] android/handsfree: Check service class is not zero Andrei Emeltchenko
2014-03-27 20:48 ` Szymon Janc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox