From c3da4e3d623a91c9e17a0aec7521fc886eab2726 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 24 Jan 2024 21:03:01 +0200 Subject: [PATCH] module_adapter: fix double-free of base_cfg_ext data Fix handling of input_pins free. Module reset can be called multiple times, so move the resource release to module_adapter_free(). Fixes: 70460043844f ("module_adapter_ipc4: Save and pre-parse base_cfg_ext data") Signed-off-by: Kai Vehmanen --- src/audio/module_adapter/module_adapter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/audio/module_adapter/module_adapter.c b/src/audio/module_adapter/module_adapter.c index cde176f2f..61d098c2e 100644 --- a/src/audio/module_adapter/module_adapter.c +++ b/src/audio/module_adapter/module_adapter.c @@ -1338,10 +1338,6 @@ int module_adapter_reset(struct comp_dev *dev) rfree(mod->stream_params); mod->stream_params = NULL; -#if CONFIG_IPC_MAJOR_4 - rfree(mod->priv.cfg.input_pins); -#endif - comp_dbg(dev, "module_adapter_reset(): done"); return comp_set_state(dev, COMP_TRIGGER_RESET); @@ -1371,6 +1367,10 @@ void module_adapter_free(struct comp_dev *dev) buffer_free(buffer); } +#if CONFIG_IPC_MAJOR_4 + rfree(mod->priv.cfg.input_pins); +#endif + rfree(mod); rfree(dev); }