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 68499b464b69..7bcfcff3ee76 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; -- 2.40.1