diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c
old mode 100644
new mode 100755
index 0d69170..7434444
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -200,6 +200,15 @@ MHD_tls_connection_shutdown (struct MHD_Connection *connection)
   {
     const int res =
       gnutls_bye (connection->tls_session, GNUTLS_SHUT_WR);
+
+    /**
+     * Modification to prevent heap exhaustion by
+     * freeing this threads random generator context.
+     */
+    gnutls_rnd_ctx_free();
+
     if (GNUTLS_E_SUCCESS == res)
     {
       connection->tls_state = MHD_TLS_CONN_WR_CLOSED;
