From 5aeb95b19bba15801fef4ee37760a6e776d3bd1a Mon Sep 17 00:00:00 2001 From: Slawomir Blauciak Date: Tue, 25 May 2021 16:55:10 +0200 Subject: [PATCH] sanity check allocated memory Issue detected by Klocwork Signed-off-by: Slawomir Blauciak --- src/adsp_config.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/adsp_config.c b/src/adsp_config.c index a9e33894e..5b26f4589 100644 --- a/src/adsp_config.c +++ b/src/adsp_config.c @@ -1773,6 +1773,9 @@ static int parse_pin(const toml_table_t *mod_entry, struct parse_ctx *ctx, ext_mod_config->pin_desc = calloc(sizeof(const struct fw_pin_description), toml_array_nelem(arr) / 6); + if(!ext_mod_config->pin_desc) + return err_malloc("pin"); + j = 0; for (i = 0; ; i += 6, j++) { raw = toml_raw_at(arr, i);