[PATCHv3 01/12] android/health: Add error check when creating app

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

---
 android/health.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/android/health.c b/android/health.c
index 42c9a6e..de67475 100644
--- a/android/health.c
+++ b/android/health.c
@@ -820,6 +820,8 @@ static void bt_health_register_app(const void *buf, uint16_t len)
 
 	app = create_health_app(app_name, provider, srv_name, srv_descr,
 							cmd->num_of_mdep);
+	if (!app)
+		goto fail;
 
 	if (!queue_push_tail(apps, app))
 		goto fail;
@@ -830,7 +832,9 @@ static void bt_health_register_app(const void *buf, uint16_t len)
 	return;
 
 fail:
-	free_health_app(app);
+	if (app)
+		free_health_app(app);
+
 	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_MDEP,
 							HAL_STATUS_FAILED);
 }
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux