diff options
| author | Roman Arutyunyan <arut@nginx.com> | 2024-05-23 19:15:38 +0400 |
|---|---|---|
| committer | Roman Arutyunyan <arut@nginx.com> | 2024-05-23 19:15:38 +0400 |
| commit | 75e3004902586f4120ddac4e3e00802a9024b79e (patch) | |
| tree | 24526e9b535347cc344135357c8f4a0837dfb311 /src/http/modules/ngx_http_grpc_module.c | |
| parent | a728869cd10924b991b22c5b50a9317226499271 (diff) | |
| download | nginx-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.c | 5 |
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; |
