From d3cd604e2598de7d378f9c6227a771a3b6345ec3 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Wed, 18 Mar 2020 14:15:06 +0100 Subject: [PATCH] kpb: add missing initialization of new memory block This patch initializes early the "next" pointer of new memory block. This is important because if further allocation fails (i.e due to not enough memory available) this block will end up with missing next pointer so every operatation on linked list of buffers will likely fail (assuming there is no check for NULL pointer) Signed-off-by: Marcin Rajwa --- src/audio/kpb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/audio/kpb.c b/src/audio/kpb.c index fb71b3638..0e8a9bfff 100644 --- a/src/audio/kpb.c +++ b/src/audio/kpb.c @@ -264,6 +264,7 @@ static size_t kpb_allocate_history_buffer(struct comp_data *kpb, if (!new_hb) return 0; history_buffer->next = new_hb; + new_hb->next = kpb->history_buffer; new_hb->state = KPB_BUFFER_OFF; new_hb->prev = history_buffer; history_buffer = new_hb;