aboutsummaryrefslogtreecommitdiff
path: root/nginx/ngx_http_js_module.c
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2022-05-26 15:28:06 +0400
committerSergey Kandaurov <pluknet@nginx.com>2022-05-26 15:28:06 +0400
commit2b30b4ffe044b44de94f129245e3981fe3363656 (patch)
tree7ff1828042ea62a931e2de7046fd937bffa4a5d8 /nginx/ngx_http_js_module.c
parentbdc93adb4d9c21d7475a03cff09d41af8b2d3f8a (diff)
downloadnjs-2b30b4ffe044b44de94f129245e3981fe3363656.tar.gz
njs-2b30b4ffe044b44de94f129245e3981fe3363656.zip
HTTP: improved memory allocation error handling.
Diffstat (limited to 'nginx/ngx_http_js_module.c')
-rw-r--r--nginx/ngx_http_js_module.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c
index 46c72026..ce20e71f 100644
--- a/nginx/ngx_http_js_module.c
+++ b/nginx/ngx_http_js_module.c
@@ -1563,6 +1563,7 @@ ngx_http_js_header_out_special(njs_vm_t *vm, ngx_http_request_t *r,
p = ngx_pnalloc(r->pool, v->length);
if (p == NULL) {
+ h->hash = 0;
return NJS_ERROR;
}
@@ -1575,6 +1576,7 @@ ngx_http_js_header_out_special(njs_vm_t *vm, ngx_http_request_t *r,
if (h != NULL) {
p = ngx_pnalloc(r->pool, s.length);
if (p == NULL) {
+ h->hash = 0;
return NJS_ERROR;
}
@@ -1803,6 +1805,7 @@ ngx_http_js_header_generic(njs_vm_t *vm, ngx_http_request_t *r,
p = ngx_pnalloc(r->pool, name->length);
if (p == NULL) {
+ h->hash = 0;
return NJS_ERROR;
}
@@ -1813,6 +1816,7 @@ ngx_http_js_header_generic(njs_vm_t *vm, ngx_http_request_t *r,
p = ngx_pnalloc(r->pool, s.length);
if (p == NULL) {
+ h->hash = 0;
return NJS_ERROR;
}
@@ -2858,6 +2862,7 @@ ngx_http_js_ext_variables(njs_vm_t *vm, njs_object_prop_t *prop,
vv->data = ngx_pnalloc(r->pool, s.length);
if (vv->data == NULL) {
+ vv->valid = 0;
njs_vm_error(vm, "internal error");
return NJS_ERROR;
}