\r
Internal functions to operate Working Block Space.\r
\r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
// Write the memory buffer to spare block\r
//\r
Status = FtwEraseSpareBlock (FtwDevice);\r
+ if (EFI_ERROR (Status)) {\r
+ FreePool (TempBuffer);\r
+ FreePool (SpareBuffer);\r
+ return EFI_ABORTED;\r
+ }\r
Ptr = TempBuffer;\r
for (Index = 0; TempBufferSize > 0; Index += 1) {\r
if (TempBufferSize > FtwDevice->SpareBlockSize) {\r
// Restore spare backup buffer into spare block , if no failure happened during FtwWrite.\r
//\r
Status = FtwEraseSpareBlock (FtwDevice);\r
+ if (EFI_ERROR (Status)) {\r
+ FreePool (SpareBuffer);\r
+ return EFI_ABORTED;\r
+ }\r
Ptr = SpareBuffer;\r
for (Index = 0; Index < FtwDevice->NumberOfSpareBlock; Index += 1) {\r
Length = FtwDevice->SpareBlockSize;\r