]> git.kaiwu.me - njs.git/commitdiff
Modules: introduced NGX_CHB_CTX_INIT().
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 15 May 2025 02:36:33 +0000 (19:36 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Thu, 22 May 2025 23:54:29 +0000 (16:54 -0700)
nginx/ngx_js.h
src/njs_chb.c

index bb7c1d26f0da5ce1042ad83e781bdbe3fd100585..ceb82f7448ffee0f631a3498d080fee861b4587b 100644 (file)
@@ -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;
index 3ee2800948376b5780b4d6e161226ee7183a53af..ac88c0bdbbab97165972f48dbca824e01cbeec33 100644 (file)
@@ -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;
     }
 }