From 5f7431d0cf57f68b0f2ad7cb89684c7ec3a4c252 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Fri, 10 Jul 2009 18:06:01 +0000 Subject: [PATCH 1/1] fix build breaks. and allow for new lists to be created. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8885 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 7b7533a327..54b6a43e03 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -1302,7 +1302,8 @@ InternalShellConvertFileListType ( and will process '?' and '*' as such. the list must be freed with a call to ShellCloseFileMetaArg(). - If you are NOT appending to an existing list *ListHead must be NULL. + If you are NOT appending to an existing list *ListHead must be NULL. If + *ListHead is NULL then it must be callee freed. @param Arg pointer to path string @param OpenMode mode to open files with @@ -1337,6 +1338,13 @@ ShellOpenFileMetaArg ( // Check for UEFI Shell 2.0 protocols // if (mEfiShellProtocol != NULL) { + if (*ListHead == NULL) { + *ListHead = (EFI_SHELL_FILE_INFO*)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); + if (*ListHead == NULL) { + return (EFI_OUT_OF_RESOURCES); + } + InitializeListHead(&((*ListHead)->Link)); + } return (mEfiShellProtocol->OpenFileList(Arg, OpenMode, ListHead)); @@ -2162,4 +2170,4 @@ ShellPrintEx( FreePool(PostReplaceFormat2); return (Return); -} \ No newline at end of file +} -- 2.39.2