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 <marcin.rajwa@linux.intel.com>
This commit is contained in:
Marcin Rajwa 2020-03-18 14:15:06 +01:00 committed by Liam Girdwood
parent 94290b1eaa
commit d3cd604e25
1 changed files with 1 additions and 0 deletions

View File

@ -264,6 +264,7 @@ static size_t kpb_allocate_history_buffer(struct comp_data *kpb,
if (!new_hb) if (!new_hb)
return 0; return 0;
history_buffer->next = new_hb; history_buffer->next = new_hb;
new_hb->next = kpb->history_buffer;
new_hb->state = KPB_BUFFER_OFF; new_hb->state = KPB_BUFFER_OFF;
new_hb->prev = history_buffer; new_hb->prev = history_buffer;
history_buffer = new_hb; history_buffer = new_hb;