Free cert usage before return
The ASN1 free will slowly leak memory for incorrect mutual auth
connections because if the certificate does not match the requirements
the function will return without freeing the usage string.
Tested: curl --cert client-cert.pem --key client-key.pem --cacert \
CA-cert.pem https://${bmc}/redfish/v1/SessionService/Sessions
Change-Id: I4c335d3cd151187c7a10e7e668d1556c11389039
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 6172b3a..fb64014 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -173,6 +173,7 @@
isKeyUsageKeyAgreement = true;
}
}
+ ASN1_BIT_STRING_free(usage);
if (!isKeyUsageDigitalSignature || !isKeyUsageKeyAgreement)
{
@@ -182,7 +183,6 @@
"be used for user authentication";
return true;
}
- ASN1_BIT_STRING_free(usage);
// Determine that ExtendedKeyUsage includes Client Auth