details:   
https://github.com/nginx/njs/commit/36aec3d75898a4f695f2a5759706312bdb82deee
branches:  master
commit:    36aec3d75898a4f695f2a5759706312bdb82deee
user:      Dmitry Volyntsev <xei...@nginx.com>
date:      Wed, 14 May 2025 19:36:33 -0700
description:
Modules: introduced NGX_CHB_CTX_INIT().


---
 nginx/ngx_js.h | 3 +++
 src/njs_chb.c  | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

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;
     }
 }
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to