未验证 提交 d7ffd573 编写于 作者: B Billy 提交者: GitHub

Fixes stream load memory leak in WifiSecureClient for SSL CACert, Certificate, and (#6387)

Private Key. Issue presented during any subsequent invocation of loadCACert, loadCertificate, and
loadPrivateKey, respectively, after the first invocation.
上级 b88a70a0
......@@ -315,6 +315,7 @@ char *WiFiClientSecure::_streamLoad(Stream& stream, size_t size) {
}
bool WiFiClientSecure::loadCACert(Stream& stream, size_t size) {
if (_CA_cert != NULL) free(const_cast<char*>(_CA_cert));
char *dest = _streamLoad(stream, size);
bool ret = false;
if (dest) {
......@@ -325,6 +326,7 @@ bool WiFiClientSecure::loadCACert(Stream& stream, size_t size) {
}
bool WiFiClientSecure::loadCertificate(Stream& stream, size_t size) {
if (_cert != NULL) free(const_cast<char*>(_cert));
char *dest = _streamLoad(stream, size);
bool ret = false;
if (dest) {
......@@ -335,6 +337,7 @@ bool WiFiClientSecure::loadCertificate(Stream& stream, size_t size) {
}
bool WiFiClientSecure::loadPrivateKey(Stream& stream, size_t size) {
if (_private_key != NULL) free(const_cast<char*>(_private_key));
char *dest = _streamLoad(stream, size);
bool ret = false;
if (dest) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册