diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2013-12-03 17:53:10 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-12-08 17:32:05 +0200 |
commit | 22d3278a5a02f8e1366ef930a4e02ce91c87e14c (patch) | |
tree | 482f0750cc2572c4cdde0c12885532377ca46f99 | |
parent | 64f5cc173871be1cc9e18b74d6af220ac9a7752e (diff) | |
download | bluez-22d3278a5a02f8e1366ef930a4e02ce91c87e14c.tar.gz |
android/pan: Fix no return on error path
This fixes possible crash in case connect fails.
-rw-r--r-- | android/pan.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/android/pan.c b/android/pan.c index 87fa4e852..26c28a253 100644 --- a/android/pan.c +++ b/android/pan.c @@ -170,8 +170,7 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer data) if (err) { error("%s", err->message); - bt_pan_notify_conn_state(dev, HAL_PAN_STATE_DISCONNECTED); - pan_device_free(dev); + goto fail; } src = (local_role == HAL_PAN_ROLE_NAP) ? BNEP_SVC_NAP : BNEP_SVC_PANU; @@ -181,10 +180,14 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer data) perr = bnep_connect(sk, src, dst, bnep_conn_cb, dev); if (perr < 0) { error("bnep connect req failed: %s", strerror(-perr)); - bt_pan_notify_conn_state(dev, HAL_PAN_STATE_DISCONNECTED); - pan_device_free(dev); - return; + goto fail; } + + return; + +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) |