sanity check allocated memory

Issue detected by Klocwork

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
This commit is contained in:
Slawomir Blauciak 2021-05-25 16:55:10 +02:00 committed by Liam Girdwood
parent 6f45b61921
commit 5aeb95b19b
1 changed files with 3 additions and 0 deletions

View File

@ -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), ext_mod_config->pin_desc = calloc(sizeof(const struct fw_pin_description),
toml_array_nelem(arr) / 6); toml_array_nelem(arr) / 6);
if(!ext_mod_config->pin_desc)
return err_malloc("pin");
j = 0; j = 0;
for (i = 0; ; i += 6, j++) { for (i = 0; ; i += 6, j++) {
raw = toml_raw_at(arr, i); raw = toml_raw_at(arr, i);