add wolfSSL_new() pointer return check on all calls in example client

This commit is contained in:
toddouska
2015-10-16 14:12:38 -07:00
parent 1253c86c95
commit c93c6c9bf4

View File

@@ -143,6 +143,8 @@ int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
for (i = 0; i < times; i++) { for (i = 0; i < times; i++) {
SOCKET_T sockfd; SOCKET_T sockfd;
WOLFSSL* ssl = wolfSSL_new(ctx); WOLFSSL* ssl = wolfSSL_new(ctx);
if (ssl == NULL)
err_sys("unable to get SSL object");
tcp_connect(&sockfd, host, port, doDTLS, ssl); tcp_connect(&sockfd, host, port, doDTLS, ssl);
@@ -181,6 +183,8 @@ int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
start = current_time(); start = current_time();
ssl = wolfSSL_new(ctx); ssl = wolfSSL_new(ctx);
if (ssl == NULL)
err_sys("unable to get SSL object");
tcp_connect(&sockfd, host, port, doDTLS, ssl); tcp_connect(&sockfd, host, port, doDTLS, ssl);
wolfSSL_set_fd(ssl, sockfd); wolfSSL_set_fd(ssl, sockfd);
if (wolfSSL_connect(ssl) == SSL_SUCCESS) { if (wolfSSL_connect(ssl) == SSL_SUCCESS) {
@@ -1101,6 +1105,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
if (resumeSession) { if (resumeSession) {
session = wolfSSL_get_session(ssl); session = wolfSSL_get_session(ssl);
sslResume = wolfSSL_new(ctx); sslResume = wolfSSL_new(ctx);
if (sslResume == NULL)
err_sys("unable to get SSL object");
} }
#endif #endif