From 3a9652d8396bdcf6f9f9c4e09f0557a6aae6cc5d Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Thu, 27 Sep 2018 17:32:29 +0200 Subject: [PATCH] host: don't free empty buffer list Don't free empty buffer list on host component free. Signed-off-by: Tomasz Lauda --- src/audio/host.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/audio/host.c b/src/audio/host.c index afb1e6b56..31465e029 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -423,14 +423,16 @@ static void host_free(struct comp_dev *dev) trace_host("fre"); - elem = list_first_item(&hd->config.elem_list, - struct dma_sg_elem, list); - #if !defined CONFIG_DMA_GW dma_channel_put(hd->dma, hd->chan); #endif - rfree(elem); + if (!list_is_empty(&hd->config.elem_list)) { + elem = list_first_item(&hd->config.elem_list, + struct dma_sg_elem, list); + rfree(elem); + } + rfree(hd); rfree(dev); }