cmocka: eq_iir and eq_fir: Fix test crash#10216
Merged
kv2019i merged 1 commit intothesofproject:mainfrom Sep 5, 2025
Merged
Conversation
Assign mod->stream_params to NULL aftere it is freed. If this is not done comp_free() tries to free it again couple of lines later, when it calls module_adapter_free(). Removing test_free(mod->stream_params) does not fix the issue because cmocka framework provided test_alloc() and test_free() are not equivalent to malloc() and free(). Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a test crash in cmocka tests for eq_iir and eq_fir modules by preventing double-free errors. The issue occurs when comp_free() attempts to free mod->stream_params after it has already been freed in the teardown function.
- Set
mod->stream_paramsto NULL after freeing it in teardown functions - Prevent double-free crashes when
comp_free()callsmodule_adapter_free()
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/cmocka/src/audio/eq_iir/eq_iir_process.c | Adds NULL assignment after freeing stream_params to prevent double-free |
| test/cmocka/src/audio/eq_fir/eq_fir_process.c | Adds NULL assignment after freeing stream_params to prevent double-free |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
kv2019i
approved these changes
Sep 5, 2025
dbaluta
approved these changes
Sep 5, 2025
marcinszkudlinski
approved these changes
Sep 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assign mod->stream_params to NULL aftere it is freed. If this is not done comp_free() tries to free it again couple of lines later, when it calls module_adapter_free(). Removing test_free(mod->stream_params) does not fix the issue because cmocka framework provided test_alloc() and test_free() are not equivalent to malloc() and free().