From: Dmitry Volyntsev Date: Thu, 15 May 2025 02:36:33 +0000 (-0700) Subject: Modules: introduced NGX_CHB_CTX_INIT(). X-Git-Tag: 0.9.1~39 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=36aec3d75898a4f695f2a5759706312bdb82deee;p=njs.git Modules: introduced NGX_CHB_CTX_INIT(). --- diff --git a/nginx/ngx_js.h b/nginx/ngx_js.h index bb7c1d26..ceb82f74 100644 --- a/nginx/ngx_js.h +++ b/nginx/ngx_js.h @@ -317,6 +317,9 @@ ngx_int_t ngx_js_exception(njs_vm_t *vm, ngx_str_t *s); ngx_engine_t *ngx_njs_clone(ngx_js_ctx_t *ctx, ngx_js_loc_conf_t *cf, void *external); +#define NGX_CHB_CTX_INIT(chain, pool) \ + njs_chb_init(chain, pool, (njs_chb_alloc_t) ngx_palloc, NULL) + #if (NJS_HAVE_QUICKJS) typedef struct ngx_qjs_event_s ngx_qjs_event_t; diff --git a/src/njs_chb.c b/src/njs_chb.c index 3ee28009..ac88c0bd 100644 --- a/src/njs_chb.c +++ b/src/njs_chb.c @@ -251,7 +251,11 @@ njs_chb_destroy(njs_chb_t *chain) while (n != NULL) { next = n->next; - chain->free(chain->pool, n); + + if (chain->free != NULL) { + chain->free(chain->pool, n); + } + n = next; } }