Two additional scenarios in which CloseEvent() needs to be called:

We sent a Request to HTTP server, following which we did a
Response() call, with the intent of capturing only the headers.
In this case, we execute an if condition in HttpResponseWorker do
a goto Exit. HttpDxe will cache the body that it received for which
we dint ask for right now. After we have received the headers, we
call a Response() again. Now, we get the data out of cache and
again do a goto Exit. In both cases, two CreateEvent() are called,
one on Event in RxToken in Wrap structure and another on Event in
RxToken in HttpInstance structure. In Exit label, we are missing
the CloseEvent() call for both the Events created.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nagaraj Hegde <nagaraj-p.he...@hpe.com>
---
 NetworkPkg/HttpDxe/HttpImpl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 3094400..0e7e60d 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -1130,6 +1130,18 @@ Exit:
   }
   Token->Status = Status;
   gBS->SignalEvent (Token->Event);
+
+  if (Wrap != NULL) {
+    if (Wrap->TcpWrap.RxToken.CompletionToken.Event != NULL) {
+      gBS->CloseEvent (Wrap->TcpWrap.RxToken.CompletionToken.Event);
+    }
+  }
+
+  if (HttpInstance->RxToken.CompletionToken.Event != NULL) {
+    gBS->CloseEvent (HttpInstance->RxToken.CompletionToken.Event);
+    HttpInstance->RxToken.CompletionToken.Event = NULL;
+  }
+
   FreePool (Wrap);
   return Status;
 
-- 
2.6.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to