summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorSepalani <sepalani@hotmail.fr>2016-06-25 17:12:06 +0400
committerSepalani <sepalani@hotmail.fr>2016-07-01 14:33:58 +0400
commit99a741b4e21dc3a3e2f977b550416d98df8a4660 (patch)
treef2c726678f690d37aff245c040503710d20dad97 /Source/Core
parent1af3b51fa7e833f072f77da8339c99f0889c8370 (diff)
mbedTLS: missing init and free fixed
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
index 9d21f6f627..8f29e83ea4 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
@@ -41,13 +41,16 @@ CWII_IPC_HLE_Device_net_ssl::~CWII_IPC_HLE_Device_net_ssl()
if (ssl.active)
{
mbedtls_ssl_close_notify(&ssl.ctx);
- mbedtls_ssl_session_free(&ssl.session);
- mbedtls_ssl_free(&ssl.ctx);
- mbedtls_ssl_config_free(&ssl.config);
mbedtls_x509_crt_free(&ssl.cacert);
mbedtls_x509_crt_free(&ssl.clicert);
+ mbedtls_ssl_session_free(&ssl.session);
+ mbedtls_ssl_free(&ssl.ctx);
+ mbedtls_ssl_config_free(&ssl.config);
+ mbedtls_ctr_drbg_free(&ssl.ctr_drbg);
+ mbedtls_entropy_free(&ssl.entropy);
+
ssl.hostname.clear();
ssl.active = false;
@@ -163,13 +166,14 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
WII_SSL* ssl = &_SSL[sslID];
mbedtls_ssl_init(&ssl->ctx);
mbedtls_entropy_init(&ssl->entropy);
- const char* pers = "dolphin-emu";
+ static constexpr const char* pers = "dolphin-emu";
mbedtls_ctr_drbg_init(&ssl->ctr_drbg);
int ret = mbedtls_ctr_drbg_seed(&ssl->ctr_drbg, mbedtls_entropy_func, &ssl->entropy,
(const unsigned char*)pers, strlen(pers));
if (ret)
{
mbedtls_ssl_free(&ssl->ctx);
+ mbedtls_ctr_drbg_free(&ssl->ctr_drbg);
mbedtls_entropy_free(&ssl->entropy);
goto _SSL_NEW_ERROR;
}
@@ -218,16 +222,18 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
if (SSLID_VALID(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
+
mbedtls_ssl_close_notify(&ssl->ctx);
+
+ mbedtls_x509_crt_free(&ssl->cacert);
+ mbedtls_x509_crt_free(&ssl->clicert);
+
mbedtls_ssl_session_free(&ssl->session);
mbedtls_ssl_free(&ssl->ctx);
mbedtls_ssl_config_free(&ssl->config);
-
+ mbedtls_ctr_drbg_free(&ssl->ctr_drbg);
mbedtls_entropy_free(&ssl->entropy);
- mbedtls_x509_crt_free(&ssl->cacert);
- mbedtls_x509_crt_free(&ssl->clicert);
-
ssl->hostname.clear();
ssl->active = false;