]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / C / Common / FirmwareVolumeBuffer.c
index 7988d8e43a059a62dfac85d0f4528a153e1f8767..6e1914be29a082baede48e83714dfb71c704eba8 100644 (file)
@@ -1,14 +1,8 @@
 /** @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
-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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -186,6 +180,7 @@ Returns:
 \r
   Status = FvBufClearAllFiles (TempFv);\r
   if (EFI_ERROR (Status)) {\r
+    CommonLibBinderFree (TempFv);\r
     return Status;\r
   }\r
 \r
@@ -353,6 +348,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
@@ -1650,7 +1648,7 @@ FvBufCalculateSum16 (
   IN UINTN        Size\r
   )\r
 /*++\r
-  \r
+\r
 Routine Description:\r
 \r
   This function calculates the UINT16 sum for the requested region.\r
@@ -1689,7 +1687,7 @@ FvBufCalculateChecksum16 (
   IN UINTN        Size\r
   )\r
 /*++\r
-  \r
+\r
 Routine Description::\r
 \r
   This function calculates the value needed for a valid UINT16 checksum\r