ShellPkg: prevent Close call when Open failed

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18096 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jaben Carsey 2015-07-28 20:22:26 +00:00 committed by jcarsey
parent 6394c35a7d
commit 983fffd431
1 changed files with 3 additions and 2 deletions

View File

@ -702,9 +702,10 @@ ShellOpenFileByName(
}
PathCleanUpDirectories (FileNameCopy);
if (PathRemoveLastItem (FileNameCopy)) {
ShellCreateDirectory (FileNameCopy, FileHandle);
if (!EFI_ERROR(ShellCreateDirectory (FileNameCopy, FileHandle))) {
ShellCloseFile (FileHandle);
}
}
SHELL_FREE_NON_NULL (FileNameCopy);
}