From 24f5c65b5a87de959d32d75b6d27fcadbb2e37d0 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 16 Feb 2022 13:45:13 -0500 Subject: [PATCH] shell: fix history memory reclaim No ring_buf_get_finish() should be performed on ring_buf memory that wasn't claimed beforehand. Using ring_buf_get() with a NULL destination does both the claim and the finish part without retrieving anything. This is especially important with the ring_buffer revanp where the above is enforced for proper operation. Signed-off-by: Nicolas Pitre --- subsys/shell/shell_history.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/shell/shell_history.c b/subsys/shell/shell_history.c index a4d37d562e3..0156ea8a31a 100644 --- a/subsys/shell/shell_history.c +++ b/subsys/shell/shell_history.c @@ -116,7 +116,7 @@ static bool remove_from_tail(struct shell_history *history) total_len = offsetof(struct shell_history_item, data) + h_item->len + h_item->padding; - ring_buf_get_finish(history->ring_buf, total_len); + ring_buf_get(history->ring_buf, NULL, total_len); return true; }