UINTN Height;\r
UINTN Width;\r
UINTN ImageIndex;\r
-\r
+ BOOLEAN IsAllocated;\r
+ \r
BmpHeader = (BMP_IMAGE_HEADER *) BmpImage;\r
if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {\r
return EFI_UNSUPPORTED;\r
ImageHeader = Image;\r
\r
BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_UGA_PIXEL);\r
+ IsAllocated = FALSE;\r
if (*UgaBlt == NULL) {\r
*UgaBltSize = BltBufferSize;\r
*UgaBlt = AllocatePool (*UgaBltSize);\r
if (*UgaBlt == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
+ IsAllocated = TRUE;\r
} else {\r
if (*UgaBltSize < BltBufferSize) {\r
*UgaBltSize = BltBufferSize;\r
break;\r
\r
default:\r
+ if (IsAllocated) {\r
+ gBS->FreePool (*UgaBlt);\r
+ *UgaBlt = NULL;\r
+ }\r
return EFI_UNSUPPORTED;\r
break;\r
};\r