ipc: buffer: Properly free buffer using buffer_free instead of rfree.

In case of lack of memory to allocate control struct for newly created
buffer, pointer to that buffer was rfree'd instead of proper buffer_free
call, which would have resulted in memory leak. This patch is to address
this issue.

Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
This commit is contained in:
Artur Kloniecki 2020-03-17 21:32:33 +01:00 committed by Liam Girdwood
parent 6e43ab8ecd
commit 6749a36c3c
1 changed files with 1 additions and 1 deletions

View File

@ -274,7 +274,7 @@ int ipc_buffer_new(struct ipc *ipc, struct sof_ipc_buffer *desc)
ibd = rzalloc(SOF_MEM_ZONE_RUNTIME, SOF_MEM_FLAG_SHARED, ibd = rzalloc(SOF_MEM_ZONE_RUNTIME, SOF_MEM_FLAG_SHARED,
SOF_MEM_CAPS_RAM, sizeof(struct ipc_comp_dev)); SOF_MEM_CAPS_RAM, sizeof(struct ipc_comp_dev));
if (ibd == NULL) { if (ibd == NULL) {
rfree(buffer); buffer_free(buffer);
return -ENOMEM; return -ENOMEM;
} }
ibd->cb = buffer; ibd->cb = buffer;