summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules/ngx_http_grpc_module.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2024-05-23 19:15:38 +0400
committerRoman Arutyunyan <arut@nginx.com>2024-05-23 19:15:38 +0400
commit75e3004902586f4120ddac4e3e00802a9024b79e (patch)
tree24526e9b535347cc344135357c8f4a0837dfb311 /src/http/modules/ngx_http_grpc_module.c
parenta728869cd10924b991b22c5b50a9317226499271 (diff)
downloadnginx-75e3004902586f4120ddac4e3e00802a9024b79e.tar.gz
nginx-75e3004902586f4120ddac4e3e00802a9024b79e.tar.bz2
Optimized chain link usage (ticket #2614).
Previously chain links could sometimes be dropped instead of being reused, which could result in increased memory consumption during long requests. A similar chain link issue in ngx_http_gzip_filter_module was fixed in da46bfc484ef (1.11.10). Based on a patch by Sangmin Lee.
Diffstat (limited to 'src/http/modules/ngx_http_grpc_module.c')
-rw-r--r--src/http/modules/ngx_http_grpc_module.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c
index dfe49c586..e7726f314 100644
--- a/src/http/modules/ngx_http_grpc_module.c
+++ b/src/http/modules/ngx_http_grpc_module.c
@@ -1231,7 +1231,7 @@ ngx_http_grpc_body_output_filter(void *data, ngx_chain_t *in)
ngx_buf_t *b;
ngx_int_t rc;
ngx_uint_t next, last;
- ngx_chain_t *cl, *out, **ll;
+ ngx_chain_t *cl, *out, *ln, **ll;
ngx_http_upstream_t *u;
ngx_http_grpc_ctx_t *ctx;
ngx_http_grpc_frame_t *f;
@@ -1459,7 +1459,10 @@ ngx_http_grpc_body_output_filter(void *data, ngx_chain_t *in)
last = 1;
}
+ ln = in;
in = in->next;
+
+ ngx_free_chain(r->pool, ln);
}
ctx->in = in;