vendor/nginx/src/event/ngx_event_openssl.c in nginxtra-1.2.7.8 vs vendor/nginx/src/event/ngx_event_openssl.c in nginxtra-1.2.8.8
- old
+ new
@@ -1714,22 +1714,42 @@
goto failed;
}
}
sess_id = ngx_slab_alloc_locked(shpool, sizeof(ngx_ssl_sess_id_t));
+
if (sess_id == NULL) {
- goto failed;
+
+ /* drop the oldest non-expired session and try once more */
+
+ ngx_ssl_expire_sessions(cache, shpool, 0);
+
+ sess_id = ngx_slab_alloc_locked(shpool, sizeof(ngx_ssl_sess_id_t));
+
+ if (sess_id == NULL) {
+ goto failed;
+ }
}
#if (NGX_PTR_SIZE == 8)
id = sess_id->sess_id;
#else
id = ngx_slab_alloc_locked(shpool, sess->session_id_length);
+
if (id == NULL) {
- goto failed;
+
+ /* drop the oldest non-expired session and try once more */
+
+ ngx_ssl_expire_sessions(cache, shpool, 0);
+
+ id = ngx_slab_alloc_locked(shpool, sess->session_id_length);
+
+ if (id == NULL) {
+ goto failed;
+ }
}
#endif
ngx_memcpy(cached_sess, buf, len);