From 0bf9e6453ed5175dea94a8fc88c6b74f99999d30 Mon Sep 17 00:00:00 2001 From: Andrei Istodorescu Date: Tue, 5 Mar 2024 16:15:21 +0200 Subject: 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 --- src/shared/shell.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- cgit 1.2.3-korg