summaryrefslogtreecommitdiffstats
path: root/NetworkPkg
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2018-03-22 10:31:55 +0100
committerLaszlo Ersek <lersek@redhat.com>2018-03-28 13:07:29 +0200
commit6f3487a79b41e72782c5baea996c294b4ce38960 (patch)
tree0e199333f1c0195bb9bb29dbd13feff9a14ea6e9 /NetworkPkg
parent1ba4a4df3972cec30b2aa44ff9ff53e5f5eeddc1 (diff)
downloadedk2-6f3487a79b41e72782c5baea996c294b4ce38960.tar.gz
edk2-6f3487a79b41e72782c5baea996c294b4ce38960.tar.bz2
edk2-6f3487a79b41e72782c5baea996c294b4ce38960.zip
NetworkPkg/HttpDxe: use error handler epilogue in TlsConfigCertificate()
Introduce a FreeCACert label near the end of the function, so that we can keep the FreePool(CACert) statement centralized for error and success exits. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/HttpDxe/HttpsSupport.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/NetworkPkg/HttpDxe/HttpsSupport.c b/NetworkPkg/HttpDxe/HttpsSupport.c
index 5105a2014c..9103987a0e 100644
--- a/NetworkPkg/HttpDxe/HttpsSupport.c
+++ b/NetworkPkg/HttpDxe/HttpsSupport.c
@@ -425,9 +425,8 @@ TlsConfigCertificate (
// GetVariable still error or the variable is corrupted.
// Fall back to the default value.
//
- FreePool (CACert);
-
- return EFI_NOT_FOUND;
+ Status = EFI_NOT_FOUND;
+ goto FreeCACert;
}
ASSERT (CACert != NULL);
@@ -451,8 +450,7 @@ TlsConfigCertificate (
CertList->SignatureSize - sizeof (Cert->SignatureOwner)
);
if (EFI_ERROR (Status)) {
- FreePool (CACert);
- return Status;
+ goto FreeCACert;
}
Cert = (EFI_SIGNATURE_DATA *) ((UINT8 *) Cert + CertList->SignatureSize);
@@ -462,6 +460,7 @@ TlsConfigCertificate (
CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize);
}
+FreeCACert:
FreePool (CACert);
return Status;
}