HTTP: fix support for trailers in subrequests.

Previously, worker process would crash when adding trailers
in subrequests.

Change-Id: I8a4ab2c9b340686e0d7e53d7e604ba030c82ca45
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Reviewed-on: https://nginx-review.googlesource.com/2801
Reviewed-by: Lizan Zhou <zlizan@google.com>
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index f2bd87d..9ab2e1f 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -2477,6 +2477,13 @@
         return NGX_ERROR;
     }
 
+    if (ngx_list_init(&sr->headers_out.trailers, r->pool, 4,
+                      sizeof(ngx_table_elt_t))
+        != NGX_OK)
+    {
+        return NGX_ERROR;
+    }
+
     cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
     sr->main_conf = cscf->ctx->main_conf;
     sr->srv_conf = cscf->ctx->srv_conf;