Diff between 24d9ec7e1527da59e7ebeddfa80b6fcb302c3167 and b6d655f3d80ab069191de8f3fab8ecad6b32d38c

Changed Files

File Additions Deletions Status
android/gatt.c +12 -3 modified

Full Patch

diff --git a/android/gatt.c b/android/gatt.c
index 6189407..d07c82d 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5499,15 +5499,24 @@ bool bt_gatt_register(struct ipc *ipc, const bdaddr_t *addr)
 	if (!start_listening_io())
 		return false;
 
+	crypto = bt_crypto_new();
+	if (!crypto) {
+		error("gatt: Failed to setup crypto");
+
+		g_io_channel_unref(listening_io);
+		listening_io = NULL;
+
+		return false;
+	}
+
 	gatt_devices = queue_new();
 	gatt_apps = queue_new();
 	app_connections = queue_new();
 	listen_apps = queue_new();
 	gatt_db = gatt_db_new();
-	crypto = bt_crypto_new();
 
-	if (!gatt_devices || !gatt_apps || !listen_apps ||
-				!app_connections || !gatt_db || !crypto) {
+	if (!gatt_devices || !gatt_apps || !listen_apps || !app_connections ||
+								!gatt_db) {
 		error("gatt: Failed to allocate memory for queues");
 
 		queue_destroy(gatt_apps, NULL);