Skip to content

Commit 9830a4e

Browse files
author
Jyri Sarha
committed
audio: copier: Fix resource leak from DMA sync code error handling
The code within #if CONFIG_HOST_DMA_STREAM_SYNCHRONIZATION should free host_common resources in case of failure. The commit fixes the issue. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 2c1c94a commit 9830a4e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/audio/copier/copier_host.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ __cold int copier_host_create(struct processing_module *mod, struct copier_data
187187
return ret;
188188
}
189189
#if CONFIG_HOST_DMA_STREAM_SYNCHRONIZATION
190-
/* NOTE: Should use goto e_conv this #if section, not direct return */
191190
/* Size of a configuration without optional parameters. */
192191
const uint32_t basic_size = sizeof(*copier_cfg) +
193192
(copier_cfg->gtw_cfg.config_length - 1) * sizeof(uint32_t);
@@ -206,14 +205,16 @@ __cold int copier_host_create(struct processing_module *mod, struct copier_data
206205
if (value_ptr) {
207206
struct ipc4_copier_sync_group *sync_group;
208207

209-
if (value_size != sizeof(struct ipc4_copier_sync_group))
210-
return -EINVAL;
208+
if (value_size != sizeof(struct ipc4_copier_sync_group)) {
209+
ret = -EINVAL;
210+
goto e_conv;
211+
}
211212

212213
sync_group = (struct ipc4_copier_sync_group *)((void *)value_ptr);
213214

214215
ret = add_to_fpi_sync_group(dev, hd, sync_group);
215216
if (ret < 0)
216-
return ret;
217+
goto e_conv;
217218
}
218219
}
219220
#endif

0 commit comments

Comments
 (0)