diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2022-03-24 20:04:34 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-03-28 00:51:30 +0000 |
commit | 7b005f344e533cd913c3ca05b266f9872df886d1 (patch) | |
tree | f2a2d8559f2be0e31ce7198604b95af58b0c9600 /BaseTools | |
parent | 355515a06a609327794070a91efe26a45a2e3325 (diff) | |
download | edk2-7b005f344e533cd913c3ca05b266f9872df886d1.tar.gz edk2-7b005f344e533cd913c3ca05b266f9872df886d1.tar.bz2 edk2-7b005f344e533cd913c3ca05b266f9872df886d1.zip |
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>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/C/GenFfs/GenFfs.c | 2 | ||||
-rw-r--r-- | BaseTools/Source/C/GenSec/GenSec.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c index 949025c333..d78d62ab36 100644 --- a/BaseTools/Source/C/GenFfs/GenFfs.c +++ b/BaseTools/Source/C/GenFfs/GenFfs.c @@ -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);
diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c index d54a4f9e0a..b1d05367ec 100644 --- a/BaseTools/Source/C/GenSec/GenSec.c +++ b/BaseTools/Source/C/GenSec/GenSec.c @@ -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);
|