smex: fix crash in elf_free_module() when input file not found

fclose() seems to require a valid argument.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2021-07-06 03:25:52 +00:00 committed by Liam Girdwood
parent 4c06d00084
commit 53ebd8abd0
1 changed files with 2 additions and 1 deletions

View File

@ -536,5 +536,6 @@ void elf_free_module(struct elf_module *module)
free(module->prg);
free(module->section);
free(module->strings);
fclose(module->fd);
if (module->fd)
fclose(module->fd);
}