diff options
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c')
-rw-r--r-- | ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c index c3927ca..afa6a50 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c @@ -203,12 +203,18 @@ CopySingleFile ( if (Status == EFI_BUFFER_TOO_SMALL) {
DestVolumeInfo = AllocateZeroPool (DestVolumeInfoSize);
- Status = DestVolumeFP->GetInfo (
- DestVolumeFP,
- &gEfiFileSystemInfoGuid,
- &DestVolumeInfoSize,
- DestVolumeInfo
- );
+ if (DestVolumeInfo == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"cp");
+ ShellStatus = SHELL_OUT_OF_RESOURCES;
+ goto Done;
+ }
+
+ Status = DestVolumeFP->GetInfo (
+ DestVolumeFP,
+ &gEfiFileSystemInfoGuid,
+ &DestVolumeInfoSize,
+ DestVolumeInfo
+ );
}
//
@@ -246,11 +252,14 @@ CopySingleFile ( break;
}
}
+
+ FreePool (Buffer);
}
SHELL_FREE_NON_NULL (DestVolumeInfo);
}
+Done:
//
// close files
//
|