Fix swapping of first and last entry in SSL session cache

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
diff --git a/library/ssl_cache.c b/library/ssl_cache.c
index f337547..11afd86 100644
--- a/library/ssl_cache.c
+++ b/library/ssl_cache.c
@@ -225,7 +225,7 @@
 
     old = cache->chain;
     cache->chain = old->next;
-    cur->next = NULL;
+    old->next = NULL;
     prv->next = old;
 #endif /* MBEDTLS_HAVE_TIME */