diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c index 5f3d153e88..a499f9633d 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c @@ -406,6 +406,7 @@ WOLFSSL_ESP_TASK tls_smp_server_task(void *args) ESP_LOGI(TAG, "Done! Cleanup..."); /* Cleanup after this connection */ wolfSSL_free(ssl); /* Free the wolfSSL object */ + ssl = NULL; close(connd); /* Close the connection to the client */ #ifdef WOLFSSL_EXAMPLE_VERBOSITY ESP_LOGI(TAG, "Stack used: %d\n", diff --git a/IDE/QNX/example-server/server-tls.c b/IDE/QNX/example-server/server-tls.c index ef711de956..2f41b0d389 100644 --- a/IDE/QNX/example-server/server-tls.c +++ b/IDE/QNX/example-server/server-tls.c @@ -246,7 +246,7 @@ static int TLS_ECDH_callback(WOLFSSL* ssl, struct ecc_key* otherKey, int main() { int sockfd; - int connd = 0; + int connd = -1; struct sockaddr_in servAddr; struct sockaddr_in clientAddr; socklen_t size = sizeof(clientAddr); @@ -379,7 +379,8 @@ int main() end: /* Cleanup after this connection */ wolfSSL_free(ssl); /* Free the wolfSSL object */ - close(connd); /* Close the connection to the client */ + if (connd != -1) + close(connd); /* Close the connection to the client */ wc_ecc_free(&blackKey); printf("Shutdown complete\n");