summaryrefslogtreecommitdiff
path: root/android/health.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2014-08-20 10:02:03 +0300
committerSzymon Janc <szymon.janc@tieto.com>2014-08-20 10:26:32 +0200
commit05fd766946879c499a8a2baa19b8be416fc589c9 (patch)
tree9315e5eb8b97dbc857771739aef83e90f5e7978e /android/health.c
parent21fb4064f252a08b87418125cf66fb7460e0ed95 (diff)
downloadbluez-05fd766946879c499a8a2baa19b8be416fc589c9.tar.gz
android/health: Fix NULL dereference
In a case get_app(), get_device(), get_channel() fail prevent dereference of NULL pointer. Fixes clang warnings: ... android/health.c:1980:15: warning: Access to field 'dev' results in a dereference of a null pointer (loaded from variable 'channel') queue_remove(channel->dev->channels, channel); ^~~~~~~~~~~~ 1 warning generated. ...
Diffstat (limited to 'android/health.c')
-rw-r--r--android/health.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/android/health.c b/android/health.c
index c8af90ec5..665482e16 100644
--- a/android/health.c
+++ b/android/health.c
@@ -1931,15 +1931,15 @@ static void bt_health_connect_channel(const void *buf, uint16_t len)
app = get_app(cmd->app_id);
if (!app)
- goto fail;
+ goto send_rsp;
dev = get_device(app, cmd->bdaddr);
if (!dev)
- goto fail;
+ goto send_rsp;
channel = get_channel(app, cmd->mdep_index, dev);
if (!channel)
- goto fail;
+ goto send_rsp;
if (!queue_length(dev->channels)) {
if (channel->type != CHANNEL_TYPE_RELIABLE) {
@@ -1979,6 +1979,8 @@ static void bt_health_connect_channel(const void *buf, uint16_t len)
fail:
queue_remove(channel->dev->channels, channel);
free_health_channel(channel);
+
+send_rsp:
ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH,
HAL_OP_HEALTH_CONNECT_CHANNEL, HAL_STATUS_FAILED);
}