mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
BaseTools: fix gcc12 warning
GenFfs.c:545:5: error: pointer ?InFileHandle? used after ?fclose? [-Werror=use-after-free] 545 | Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GenFfs.c:544:5: note: call to ?fclose? here 544 | fclose (InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
parent
355515a06a
commit
7b005f344e
@ -542,7 +542,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
|
||||
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
||||
if (PeFileBuffer == NULL) {
|
||||
fclose (InFileHandle);
|
||||
Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
|
||||
Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
|
||||
|
@ -1062,7 +1062,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
|
||||
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
||||
if (PeFileBuffer == NULL) {
|
||||
fclose (InFileHandle);
|
||||
Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
|
||||
Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user