linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] android/a2dp: Fix possible NULL dereference
@ 2013-12-03 15:53 Andrei Emeltchenko
  2013-12-03 15:53 ` [PATCH 2/6] android/pan: Remove unneeded NULL assignment Andrei Emeltchenko
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Andrei Emeltchenko @ 2013-12-03 15:53 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Since a2dp_record may return NULL, check return value. This
silences static analysers tools.
---
 android/a2dp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/android/a2dp.c b/android/a2dp.c
index cee4bfa..36a0714 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -366,9 +366,10 @@ bool bt_a2dp_register(const bdaddr_t *addr)
 	}
 
 	rec = a2dp_record();
-	if (bt_adapter_add_record(rec, SVC_HINT_CAPTURING) < 0) {
+	if (!rec || bt_adapter_add_record(rec, SVC_HINT_CAPTURING) < 0) {
 		error("Failed to register on A2DP record");
-		sdp_record_free(rec);
+		if (rec)
+			sdp_record_free(rec);
 		g_io_channel_shutdown(server, TRUE, NULL);
 		g_io_channel_unref(server);
 		server = NULL;
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-12-09  8:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-03 15:53 [PATCH 1/6] android/a2dp: Fix possible NULL dereference Andrei Emeltchenko
2013-12-03 15:53 ` [PATCH 2/6] android/pan: Remove unneeded NULL assignment Andrei Emeltchenko
2013-12-03 15:53 ` [PATCH 3/6] android/pan: Fix no return on error path Andrei Emeltchenko
2013-12-03 15:53 ` [PATCH 4/6] android/doc: Add socket-api.txt document Andrei Emeltchenko
2013-12-03 15:53 ` [PATCH 5/6] sdp: Remove dead code Andrei Emeltchenko
2013-12-03 15:53 ` [PATCH 6/6] avdtp: Remove unneeded local variable Andrei Emeltchenko
2013-12-03 19:53 ` [PATCH 1/6] android/a2dp: Fix possible NULL dereference Luiz Augusto von Dentz
2013-12-04  8:36   ` Andrei Emeltchenko
2013-12-08 15:39     ` Luiz Augusto von Dentz
2013-12-09  8:01       ` Andrei Emeltchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).