summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
diff options
context:
space:
mode:
authormikewuping <mikewuping@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-30 07:47:44 +0000
committermikewuping <mikewuping@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-30 07:47:44 +0000
commitd4f397c0311d529e62ca3356bc6e92fb3fbdb1bc (patch)
treed97f93f15131b0d2d9c90acd3becde156b968373 /EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
parentba73bc0bc0b7bf0d29868683bba446dc5593393e (diff)
downloadedk2-platforms-d4f397c0311d529e62ca3356bc6e92fb3fbdb1bc.tar.xz
1. In event.c, a function's name is not spelled correctly, a typo.
2. In Graphics.c, Memory Leak in Graphics Library, ConvertBmpToUgaBlt(). 3. In HobLib.c, PeiBuildHobModule and three other functions do not zero hob reserved data area according to HOB spec v0.9. 4. In statuscode.h, the number of definition of EFI_SW_PEIM_PC_CAPSULE_START is equal to EFI_SW_PEIM_PC_CAPSULE_LOAD. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1861 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Library/EdkGraphicsLib/Graphics.c')
-rw-r--r--EdkModulePkg/Library/EdkGraphicsLib/Graphics.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c b/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
index 01c612abd3..52936e3c40 100644
--- a/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
+++ b/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
@@ -159,7 +159,8 @@ Returns:
UINTN Height;
UINTN Width;
UINTN ImageIndex;
-
+ BOOLEAN IsAllocated;
+
BmpHeader = (BMP_IMAGE_HEADER *) BmpImage;
if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
return EFI_UNSUPPORTED;
@@ -182,12 +183,14 @@ Returns:
ImageHeader = Image;
BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_UGA_PIXEL);
+ IsAllocated = FALSE;
if (*UgaBlt == NULL) {
*UgaBltSize = BltBufferSize;
*UgaBlt = AllocatePool (*UgaBltSize);
if (*UgaBlt == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+ IsAllocated = TRUE;
} else {
if (*UgaBltSize < BltBufferSize) {
*UgaBltSize = BltBufferSize;
@@ -256,6 +259,10 @@ Returns:
break;
default:
+ if (IsAllocated) {
+ gBS->FreePool (*UgaBlt);
+ *UgaBlt = NULL;
+ }
return EFI_UNSUPPORTED;
break;
};