Plug some resource leaks.

This commit is contained in:
Pawel Jakub Dawidek 2012-02-12 18:07:34 +01:00
parent f74ea2f034
commit 3e464c3a7d

View File

@ -48,12 +48,15 @@ boolean tls_connect(rdpTls* tls)
if (tls->ssl == NULL)
{
SSL_CTX_free(tls->ctx);
printf("SSL_new failed\n");
return false;
}
if (SSL_set_fd(tls->ssl, tls->sockfd) < 1)
{
SSL_free(tls->ssl);
SSL_CTX_free(tls->ctx);
printf("SSL_set_fd failed\n");
return false;
}
@ -63,7 +66,11 @@ boolean tls_connect(rdpTls* tls)
if (connection_status <= 0)
{
if (tls_print_error("SSL_connect", tls->ssl, connection_status))
{
SSL_free(tls->ssl);
SSL_CTX_free(tls->ctx);
return false;
}
}
return true;