Merge branch 'development' into development-restricted

* development:
  Address PR review comments
  Fix crash when calling `mbedtls_ssl_cache_free` twice
diff --git a/ChangeLog b/ChangeLog
index a740d5d..9c2cb9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -85,6 +85,8 @@
    * Fix incorrect unit in benchmark output. #850
    * Add size-checks for record and handshake message content, securing
      fragile yet non-exploitable code-paths.
+   * Fix crash when calling mbedtls_ssl_cache_free() twice. Found by
+     MilenkoMitrovic, #1104
 
 Changes
    * Extend cert_write example program by options to set the CRT version
diff --git a/library/ssl_cache.c b/library/ssl_cache.c
index c771d7f..47867f1 100644
--- a/library/ssl_cache.c
+++ b/library/ssl_cache.c
@@ -321,6 +321,7 @@
 #if defined(MBEDTLS_THREADING_C)
     mbedtls_mutex_free( &cache->mutex );
 #endif
+    cache->chain = NULL;
 }
 
 #endif /* MBEDTLS_SSL_CACHE_C */