mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-22 21:24:35 +02:00
BaseTools/GenFv: Fix file handles not being closed
Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
9639f7d378
commit
320ba37a56
@ -1161,6 +1161,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
FileBuffer = malloc (FileSize);
|
FileBuffer = malloc (FileSize);
|
||||||
if (FileBuffer == NULL) {
|
if (FileBuffer == NULL) {
|
||||||
|
fclose (NewFile);
|
||||||
Error (NULL, 0, 4001, "Resouce", "memory cannot be allocated!");
|
Error (NULL, 0, 4001, "Resouce", "memory cannot be allocated!");
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
@ -3506,6 +3507,7 @@ Returns:
|
|||||||
PeFileSize = _filelength (fileno (PeFile));
|
PeFileSize = _filelength (fileno (PeFile));
|
||||||
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
||||||
if (PeFileBuffer == NULL) {
|
if (PeFileBuffer == NULL) {
|
||||||
|
fclose (PeFile);
|
||||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
|
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
@ -3761,6 +3763,7 @@ Returns:
|
|||||||
PeFileSize = _filelength (fileno (PeFile));
|
PeFileSize = _filelength (fileno (PeFile));
|
||||||
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
||||||
if (PeFileBuffer == NULL) {
|
if (PeFileBuffer == NULL) {
|
||||||
|
fclose (PeFile);
|
||||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
|
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user