]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
BaseTools: Fix compile error on VS2010
[mirror_edk2.git] / BaseTools / Source / C / Common / FirmwareVolumeBuffer.c
index 7988d8e43a059a62dfac85d0f4528a153e1f8767..d4a635335a6e3ffbb47012d577f85d9216a1995a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 EFI Firmware Volume routines which work on a Fv image in buffers.\r
 \r
-Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2016, 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
@@ -186,6 +186,7 @@ Returns:
 \r
   Status = FvBufClearAllFiles (TempFv);\r
   if (EFI_ERROR (Status)) {\r
+    CommonLibBinderFree (TempFv);\r
     return Status;\r
   }\r
 \r
@@ -353,6 +354,9 @@ Returns:
 \r
   if (*DestinationFv == NULL) {\r
     *DestinationFv = CommonLibBinderAllocate (size);\r
+    if (*DestinationFv == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
   }\r
 \r
   CommonLibBinderCopyMem (*DestinationFv, SourceFv, size);\r