Fixed ETag memory allocation error handling.

The etag->hash must be set to 0 to avoid an empty ETag header being
returned with the 500 Internal Server Error page after the memory
allocation failure.

Reported by Markus Linnala.
This commit is contained in:
Maxim Dounin 2014-09-08 21:36:03 +04:00
parent c5bee22d16
commit 90df702bf8

View File

@ -1837,6 +1837,7 @@ ngx_http_set_etag(ngx_http_request_t *r)
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;
}