aboutsummaryrefslogtreecommitdiff
path: root/nginx/ngx_http_js_module.c
diff options
context:
space:
mode:
authorhongzhidao <hongzhidao@gmail.com>2025-03-18 21:34:59 +0800
committerhongzhidao <hongzhidao@gmail.com>2025-03-19 15:46:46 +0800
commit1d36e231ed6a317cc9d01f8223091619e89e7a65 (patch)
tree29b25ba35259da20e84a5cbd7be4a1019b772237 /nginx/ngx_http_js_module.c
parent1b7adef4d532df55d81e22ec8fe998b76de34935 (diff)
downloadnjs-1d36e231ed6a317cc9d01f8223091619e89e7a65.tar.gz
njs-1d36e231ed6a317cc9d01f8223091619e89e7a65.zip
QuickJS: calling njs_chb_destroy() in qjs_string_create_chb() internally.
No functional changes.
Diffstat (limited to 'nginx/ngx_http_js_module.c')
-rw-r--r--nginx/ngx_http_js_module.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c
index ae970eb1..369ae50b 100644
--- a/nginx/ngx_http_js_module.c
+++ b/nginx/ngx_http_js_module.c
@@ -6400,10 +6400,9 @@ ngx_http_qjs_header_generic(JSContext *cx, ngx_http_request_t *r,
ngx_list_t *headers, ngx_table_elt_t **ph, ngx_str_t *name,
JSPropertyDescriptor *pdesc, unsigned flags)
{
- int ret;
u_char sep;
- njs_chb_t chain;
JSValue val;
+ njs_chb_t chain;
ngx_uint_t i;
ngx_list_part_t *part;
ngx_table_elt_t *header, *h;
@@ -6493,6 +6492,10 @@ ngx_http_qjs_header_generic(JSContext *cx, ngx_http_request_t *r,
return 1;
}
+ if (pdesc == NULL) {
+ return 1;
+ }
+
NJS_CHB_CTX_INIT(&chain, cx);
sep = flags & NJS_HEADER_SEMICOLON ? ';' : ',';
@@ -6503,24 +6506,15 @@ ngx_http_qjs_header_generic(JSContext *cx, ngx_http_request_t *r,
njs_chb_append_literal(&chain, " ");
}
- ret = 1;
-
- if (pdesc != NULL) {
- pdesc->flags = JS_PROP_ENUMERABLE;
- pdesc->getter = JS_UNDEFINED;
- pdesc->setter = JS_UNDEFINED;
- pdesc->value = qjs_string_create_chb(cx, &chain);
- if (JS_IsException(pdesc->value)) {
- ret = -1;
- goto done;
- }
+ pdesc->flags = JS_PROP_ENUMERABLE;
+ pdesc->getter = JS_UNDEFINED;
+ pdesc->setter = JS_UNDEFINED;
+ pdesc->value = qjs_string_create_chb(cx, &chain);
+ if (JS_IsException(pdesc->value)) {
+ return -1;
}
-done:
-
- njs_chb_destroy(&chain);
-
- return ret;
+ return 1;
}