[PATCH 2 of 2] fix ETag allocation failure

Markus Linnala Markus.Linnala at cybercom.com
Sun Aug 17 20:00:30 UTC 2014


# HG changeset patch
# User Markus Linnala <Markus.Linnala at cybercom.com>
# Date 1408305457 -10800
#      Sun Aug 17 22:57:37 2014 +0300
# Node ID 6af8cc12f3c933eed752e9ca61622d27a909ca00
# Parent  d350d288cffef0e6395ae1f412842c3b55bc8d42
fix ETag allocation failure

diff -r d350d288cffe -r 6af8cc12f3c9 src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c	Sun Aug 17 22:21:56 2014 +0300
+++ b/src/http/ngx_http_core_module.c	Sun Aug 17 22:57:37 2014 +0300
@@ -1832,14 +1832,15 @@
         return NGX_ERROR;
     }
 
+    etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
+    if (etag->value.data == NULL) {
+        etag->hash = 0;
+        return NGX_ERROR;
+    }
+
     etag->hash = 1;
     ngx_str_set(&etag->key, "ETag");
 
-    etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
-    if (etag->value.data == NULL) {
-        return NGX_ERROR;
-    }
-
     etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"",
                                   r->headers_out.last_modified_time,
                                   r->headers_out.content_length_n)



More information about the nginx-devel mailing list