From 805c2dd1198760778d6460280f5cc5e93a04d612 Mon Sep 17 00:00:00 2001 From: lzeng14 Date: Fri, 27 Jul 2012 02:35:24 +0000 Subject: Close the corresponding GUIDed section extraction protocol notify event in CloseSectionStream. Signed-off-by: Star Zeng Reviewed-by: Chao Zhang git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13563 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Dxe/SectionExtraction/CoreSectionExtraction.c | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c index 8d8f9c864..40304b925 100644 --- a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c +++ b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c @@ -66,6 +66,11 @@ typedef struct { // UINTN EncapsulatedStreamHandle; EFI_GUID *EncapsulationGuid; + // + // If the section REQUIRES an extraction protocol, register for RPN + // when the required GUIDed extraction protocol becomes available. + // + EFI_EVENT Event; } CORE_SECTION_CHILD_NODE; #define CORE_SECTION_STREAM_SIGNATURE SIGNATURE_32('S','X','S','S') @@ -91,7 +96,6 @@ typedef struct { CORE_SECTION_CHILD_NODE *ChildNode; CORE_SECTION_STREAM_NODE *ParentStream; VOID *Registration; - EFI_EVENT Event; } RPN_EVENT_CONTEXT; @@ -558,6 +562,7 @@ NotifyGuidedExtraction ( // Close the event when done. // gBS->CloseEvent (Event); + Context->ChildNode->Event = NULL; FreePool (Context); } @@ -585,13 +590,13 @@ CreateGuidedExtractionRpnEvent ( Context->ChildNode = ChildNode; Context->ParentStream = ParentStream; - Context->Event = EfiCreateProtocolNotifyEvent ( - Context->ChildNode->EncapsulationGuid, - TPL_NOTIFY, - NotifyGuidedExtraction, - Context, - &Context->Registration - ); + Context->ChildNode->Event = EfiCreateProtocolNotifyEvent ( + Context->ChildNode->EncapsulationGuid, + TPL_NOTIFY, + NotifyGuidedExtraction, + Context, + &Context->Registration + ); } /** @@ -646,7 +651,7 @@ CreateChildNode ( // // Allocate a new node // - *ChildNode = AllocatePool (sizeof (CORE_SECTION_CHILD_NODE)); + *ChildNode = AllocateZeroPool (sizeof (CORE_SECTION_CHILD_NODE)); Node = *ChildNode; if (Node == NULL) { return EFI_OUT_OF_RESOURCES; @@ -1289,6 +1294,11 @@ FreeChildNode ( // CloseSectionStream (ChildNode->EncapsulatedStreamHandle); } + + if (ChildNode->Event != NULL) { + gBS->CloseEvent (ChildNode->Event); + } + // // Last, free the child node itself // -- cgit v1.2.3