]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / SectionExtraction / CoreSectionExtraction.c
index 6622eeeaf1616cf1f76f657b05a31ee7d12498b1..d678166db475423d56154c6d1c57b23a8cafc17e 100644 (file)
   3) A support protocol is not found, and the data is not available to be read\r
      without it.  This results in EFI_PROTOCOL_ERROR.\r
 \r
-Copyright (c) 2006 - 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
-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) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -67,7 +61,7 @@ typedef struct {
   UINTN                       EncapsulatedStreamHandle;\r
   EFI_GUID                    *EncapsulationGuid;\r
   //\r
-  // If the section REQUIRES an extraction protocol, register for RPN \r
+  // If the section REQUIRES an extraction protocol, register for RPN\r
   // when the required GUIDed extraction protocol becomes available.\r
   //\r
   EFI_EVENT                   Event;\r
@@ -499,7 +493,7 @@ ChildIsType (
 \r
   @return TRUE      The GuidedSectionGuid could be identified, and the pointer to\r
                     the Guided Section Extraction Protocol will be returned to *GuidedSectionExtraction.\r
-  @return FALSE     The GuidedSectionGuid could not be identified, or \r
+  @return FALSE     The GuidedSectionGuid could not be identified, or\r
                     the Guided Section Extraction Protocol has not been installed yet.\r
 \r
 **/\r
@@ -561,9 +555,9 @@ NotifyGuidedExtraction (
   UINTN                                   NewStreamBufferSize;\r
   UINT32                                  AuthenticationStatus;\r
   RPN_EVENT_CONTEXT                       *Context;\r
-  \r
+\r
   Context = RpnContext;\r
-  \r
+\r
   GuidedHeader = (EFI_GUID_DEFINED_SECTION *) (Context->ParentStream->StreamBuffer + Context->ChildNode->OffsetInStream);\r
   ASSERT (GuidedHeader->CommonHeader.Type == EFI_SECTION_GUID_DEFINED);\r
 \r
@@ -612,7 +606,7 @@ NotifyGuidedExtraction (
   gBS->CloseEvent (Event);\r
   Context->ChildNode->Event = NULL;\r
   FreePool (Context);\r
-}  \r
+}\r
 \r
 /**\r
   Constructor for RPN event when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears...\r
@@ -628,16 +622,16 @@ CreateGuidedExtractionRpnEvent (
   )\r
 {\r
   RPN_EVENT_CONTEXT *Context;\r
-  \r
+\r
   //\r
   // Allocate new event structure and context\r
   //\r
   Context = AllocatePool (sizeof (RPN_EVENT_CONTEXT));\r
   ASSERT (Context != NULL);\r
-  \r
+\r
   Context->ChildNode = ChildNode;\r
   Context->ParentStream = ParentStream;\r
\r
+\r
   Context->ChildNode->Event = EfiCreateProtocolNotifyEvent (\r
                                 Context->ChildNode->EncapsulationGuid,\r
                                 TPL_NOTIFY,\r
@@ -893,8 +887,8 @@ CreateChildNode (
         //\r
         if ((GuidedSectionAttributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) != 0) {\r
           //\r
-          // If the section REQUIRES an extraction protocol, register for RPN \r
-          // when the required GUIDed extraction protocol becomes available. \r
+          // If the section REQUIRES an extraction protocol, register for RPN\r
+          // when the required GUIDed extraction protocol becomes available.\r
           //\r
           CreateGuidedExtractionRpnEvent (Stream, Node);\r
         } else {\r
@@ -1551,7 +1545,9 @@ CustomGuidedSectionExtract (
     //\r
     AllocatedOutputBuffer = AllocatePool (OutputBufferSize);\r
     if (AllocatedOutputBuffer == NULL) {\r
-      FreePool (ScratchBuffer);\r
+      if (ScratchBuffer != NULL) {\r
+        FreePool (ScratchBuffer);\r
+      }\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
     *OutputBuffer = AllocatedOutputBuffer;\r