aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib/dir.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-12-09 21:13:09 +0300
committerJoursoir <chat@joursoir.net>2021-12-09 21:13:09 +0300
commit1205492d1c6bf7d8e938b47a76f7d0e4a8a8844f (patch)
tree682a7afc8305957ad7a210f9c4a269ac03a9ddc4 /Library/UefiShellUfmCommandLib/dir.c
parent168b13a1c52b925a0aebc3f1857562c4bc6e753f (diff)
downloadufm-1205492d1c6bf7d8e938b47a76f7d0e4a8a8844f.tar.gz
ufm-1205492d1c6bf7d8e938b47a76f7d0e4a8a8844f.tar.bz2
ufm-1205492d1c6bf7d8e938b47a76f7d0e4a8a8844f.zip
dir: make release of EFI_SHELL_FILE_INFO memory more safer
Diffstat (limited to 'Library/UefiShellUfmCommandLib/dir.c')
-rw-r--r--Library/UefiShellUfmCommandLib/dir.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/UefiShellUfmCommandLib/dir.c b/Library/UefiShellUfmCommandLib/dir.c
index 782334d..2d50173 100644
--- a/Library/UefiShellUfmCommandLib/dir.c
+++ b/Library/UefiShellUfmCommandLib/dir.c
@@ -32,10 +32,12 @@ struct dir_list *dirl_alloc(CHAR16 *search_path, CONST UINT64 attr)
// I have stolen code below in the source code of InternalFreeShellFileInfoNode():
RemoveEntryList(&node->Link);
- FreePool((VOID*)node->Info);
+ if(node->Info != NULL)
+ FreePool((VOID*)node->Info);
FreePool((VOID*)node->FileName);
FreePool((VOID*)node->FullName);
- gEfiShellProtocol->CloseFile(node->Handle);
+ if(node->Handle != NULL)
+ gEfiShellProtocol->CloseFile(node->Handle);
FreePool(node);
node = tmp;
continue;