aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAndrei Istodorescu <andrei.istodorescu@nxp.com>2024-03-05 16:15:21 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2024-03-05 17:37:41 -0500
commit0bf9e6453ed5175dea94a8fc88c6b74f99999d30 (patch)
treea4b0ab60007b6488cd98d31aec137b16c90c3168
parent7665fb5d943c3910465123fc7b08922e44adb7a2 (diff)
shared/shell: Fix heap use after free on exit
Set the value for data.inputs and data.queue queues to NULL after freeing, so that further processes won't use already freed memory
-rw-r--r--src/shared/shell.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shared/shell.c b/src/shared/shell.c
index 68499b464b..7bcfcff3ee 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -4,7 +4,7 @@
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2017 Intel Corporation. All rights reserved.
- *
+ * Copyright 2024 NXP
*
*/
@@ -1362,7 +1362,9 @@ void bt_shell_cleanup(void)
rl_cleanup();
queue_destroy(data.inputs, NULL);
+ data.inputs = NULL;
queue_destroy(data.queue, free);
+ data.queue = NULL;
queue_destroy(data.prompts, prompt_free);
data.prompts = NULL;