efi_loader: Prevent dereferencing NULL pointer
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 2 Jul 2025 10:01:36 +0000 (11:01 +0100)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 3 Jul 2025 08:32:49 +0000 (11:32 +0300)
commit9d95a35715fcb8e81ee423e31273489a47ed1563
tree0712f1fcf7ad7315ae97f3ec8a142ce9dbe18826
parent4e103418bed6374b9aa43d067cee704d7e745dc9
efi_loader: Prevent dereferencing NULL pointer

Taking the first goto error: in file_open could either result in an
attempt to dereference fh when NULL or else free fh->path which has
not been assigned to and so will be unknown. Avoid both of these
problems by passing path to free instead of fh->path.

This issue found by Smatch.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_file.c