summaryrefslogtreecommitdiff
path: root/android/pan.c
diff options
context:
space:
mode:
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>2013-12-18 16:53:10 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2013-12-19 10:10:25 +0200
commitf8a38f2f684d8805a874c3e6d4a2fb981141128d (patch)
treefdb19312c08d37cdf82cb477083bb69abf5f5b06 /android/pan.c
parent24fc2b639e6fe567633a60dd4d99eca36a0f1323 (diff)
downloadbluez-f8a38f2f684d8805a874c3e6d4a2fb981141128d.tar.gz
android/pan: Free device after sending diconnected notification
Diffstat (limited to 'android/pan.c')
-rw-r--r--android/pan.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/android/pan.c b/android/pan.c
index e410f5403..2bbba9e99 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -103,6 +103,8 @@ static void bt_pan_notify_conn_state(struct pan_device *dev, uint8_t state)
ipc_send_notif(HAL_SERVICE_ID_PAN, HAL_EV_PAN_CONN_STATE, sizeof(ev),
&ev);
+ if (dev->conn_state == HAL_PAN_STATE_DISCONNECTED)
+ pan_device_free(dev);
}
static void bt_pan_notify_ctrl_state(struct pan_device *dev, uint8_t state)
@@ -131,7 +133,6 @@ static gboolean bnep_watchdog_cb(GIOChannel *chan, GIOCondition cond,
bnep_if_down(dev->iface);
bnep_conndel(&dev->dst);
bt_pan_notify_conn_state(dev, HAL_PAN_STATE_DISCONNECTED);
- pan_device_free(dev);
return FALSE;
}
@@ -146,7 +147,6 @@ static void bnep_conn_cb(GIOChannel *chan, char *iface, int err, void *data)
error("bnep connect req failed: %s", strerror(-err));
bnep_conndel(&dev->dst);
bt_pan_notify_conn_state(dev, HAL_PAN_STATE_DISCONNECTED);
- pan_device_free(dev);
return;
}
@@ -190,7 +190,6 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer data)
fail:
bt_pan_notify_conn_state(dev, HAL_PAN_STATE_DISCONNECTED);
- pan_device_free(dev);
}
static void bt_pan_connect(const void *buf, uint16_t len)
@@ -284,7 +283,6 @@ static void bt_pan_disconnect(const void *buf, uint16_t len)
}
dev = l->data;
-
if (dev->watch) {
g_source_remove(dev->watch);
dev->watch = 0;
@@ -292,10 +290,7 @@ static void bt_pan_disconnect(const void *buf, uint16_t len)
bnep_if_down(dev->iface);
bnep_conndel(&dst);
-
bt_pan_notify_conn_state(dev, HAL_PAN_STATE_DISCONNECTED);
- pan_device_free(dev);
-
status = HAL_STATUS_SUCCESS;
failed: