mirror of https://github.com/acidanthera/audk.git
NetworkPkg/HttpDxe: Destroy the TLS instance when cleaning up the HTTP child
During clean up the HTTP child, all resources used by it should be cleaned. But currently, TLS instance is not destroyed. This patch is to fix this issue. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
This commit is contained in:
parent
6aac2db4a1
commit
45ea8a0c45
|
@ -380,6 +380,7 @@ EfiHttpRequest (
|
|||
|
||||
HttpInstance->TlsChildHandle = TlsCreateChild (
|
||||
ImageHandle,
|
||||
&(HttpInstance->TlsSb),
|
||||
&(HttpInstance->Tls),
|
||||
&(HttpInstance->TlsConfiguration)
|
||||
);
|
||||
|
|
|
@ -864,6 +864,13 @@ HttpCleanProtocol (
|
|||
NetMapClean (&HttpInstance->TxTokens);
|
||||
NetMapClean (&HttpInstance->RxTokens);
|
||||
|
||||
if (HttpInstance->TlsSb != NULL && HttpInstance->TlsChildHandle != NULL) {
|
||||
//
|
||||
// Destroy the TLS instance.
|
||||
//
|
||||
HttpInstance->TlsSb->DestroyChild (HttpInstance->TlsSb, HttpInstance->TlsChildHandle);
|
||||
}
|
||||
|
||||
if (HttpInstance->Tcp4ChildHandle != NULL) {
|
||||
gBS->CloseProtocol (
|
||||
HttpInstance->Tcp4ChildHandle,
|
||||
|
|
|
@ -166,7 +166,8 @@ typedef struct _HTTP_PROTOCOL {
|
|||
// Https Support
|
||||
//
|
||||
BOOLEAN UseHttps;
|
||||
|
||||
|
||||
EFI_SERVICE_BINDING_PROTOCOL *TlsSb;
|
||||
EFI_HANDLE TlsChildHandle; /// Tls ChildHandle
|
||||
TLS_CONFIG_DATA TlsConfigData;
|
||||
EFI_TLS_PROTOCOL *Tls;
|
||||
|
|
|
@ -140,6 +140,7 @@ IsHttpsUrl (
|
|||
Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
|
||||
@param[out] TlsSb Pointer to the TLS SERVICE_BINDING_PROTOCOL.
|
||||
@param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL instance.
|
||||
@param[out] TlsConfiguration Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.
|
||||
|
||||
|
@ -150,15 +151,14 @@ EFI_HANDLE
|
|||
EFIAPI
|
||||
TlsCreateChild (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
OUT EFI_SERVICE_BINDING_PROTOCOL **TlsSb,
|
||||
OUT EFI_TLS_PROTOCOL **TlsProto,
|
||||
OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SERVICE_BINDING_PROTOCOL *TlsSb;
|
||||
EFI_HANDLE TlsChildHandle;
|
||||
|
||||
TlsSb = NULL;
|
||||
TlsChildHandle = 0;
|
||||
|
||||
//
|
||||
|
@ -167,13 +167,13 @@ TlsCreateChild (
|
|||
gBS->LocateProtocol (
|
||||
&gEfiTlsServiceBindingProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &TlsSb
|
||||
(VOID **) TlsSb
|
||||
);
|
||||
if (TlsSb == NULL) {
|
||||
if (*TlsSb == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Status = TlsSb->CreateChild (TlsSb, &TlsChildHandle);
|
||||
Status = (*TlsSb)->CreateChild (*TlsSb, &TlsChildHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ TlsCreateChild (
|
|||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
TlsSb->DestroyChild (TlsSb, TlsChildHandle);
|
||||
(*TlsSb)->DestroyChild (*TlsSb, TlsChildHandle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ TlsCreateChild (
|
|||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
TlsSb->DestroyChild (TlsSb, TlsChildHandle);
|
||||
(*TlsSb)->DestroyChild (*TlsSb, TlsChildHandle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The header files of miscellaneous routines specific to Https for HttpDxe driver.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -37,6 +37,7 @@ IsHttpsUrl (
|
|||
Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
|
||||
@param[out] TlsSb Pointer to the TLS SERVICE_BINDING_PROTOCOL.
|
||||
@param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL instance.
|
||||
@param[out] TlsConfiguration Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.
|
||||
|
||||
|
@ -47,6 +48,7 @@ EFI_HANDLE
|
|||
EFIAPI
|
||||
TlsCreateChild (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
OUT EFI_SERVICE_BINDING_PROTOCOL **TlsSb,
|
||||
OUT EFI_TLS_PROTOCOL **TlsProto,
|
||||
OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue