# HG changeset patch
# User Maxim Dounin <mdou...@mdounin.ru>
# Date 1650492345 -10800
#      Thu Apr 21 01:05:45 2022 +0300
# Node ID 6f4890227f30be59c3260208d0b79999b802300a
# Parent  2c0188329c7d848c891feb7635fff77941449814
Headers filter: improved memory allocation error handling.

diff --git a/src/http/modules/ngx_http_headers_filter_module.c 
b/src/http/modules/ngx_http_headers_filter_module.c
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -377,6 +377,7 @@ ngx_http_set_expires(ngx_http_request_t 
 
         cc = ngx_list_push(&r->headers_out.headers);
         if (cc == NULL) {
+            e->hash = 0;
             return NGX_ERROR;
         }
 
@@ -410,6 +411,8 @@ ngx_http_set_expires(ngx_http_request_t 
 
     e->value.data = ngx_pnalloc(r->pool, len);
     if (e->value.data == NULL) {
+        e->hash = 0;
+        cc->hash = 0;
         return NGX_ERROR;
     }
 
@@ -447,6 +450,7 @@ ngx_http_set_expires(ngx_http_request_t 
     cc->value.data = ngx_pnalloc(r->pool,
                                  sizeof("max-age=") + NGX_TIME_T_LEN + 1);
     if (cc->value.data == NULL) {
+        cc->hash = 0;
         return NGX_ERROR;
     }
 

_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-le...@nginx.org

Reply via email to