Skip to content

Commit 112ef16

Browse files
committed
samples: detect_test: add NULL check for comp_data_blob_handler_new()
comp_data_blob_handler_new() can return NULL on allocation failure. test_keyword_new() passed the result directly to comp_init_data_blob() without checking, leading to a NULL pointer dereference. Add the missing check and route to the existing cd_fail cleanup path, matching the pattern used by dcblock, google_hotword_detect, and other blob-using components. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
1 parent 3c391c6 commit 112ef16

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/samples/audio/detect_test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ static struct comp_dev *test_keyword_new(const struct comp_driver *drv,
690690

691691
/* component model data handler */
692692
cd->model_handler = comp_data_blob_handler_new(dev);
693+
if (!cd->model_handler) {
694+
comp_err(dev, "comp_data_blob_handler_new failed");
695+
goto cd_fail;
696+
}
693697

694698
#if CONFIG_IPC_MAJOR_4
695699
/* For IPC4 we only receive the base_cfg, make a copy of it */

0 commit comments

Comments
 (0)