From: Dmitry Volyntsev Date: Thu, 11 May 2023 03:50:53 +0000 (-0700) Subject: Fixed memory allocation failure introduced in fc8d1b125cef. X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=eca430c94fc87804523f368a86350646328490cb;p=njs.git Fixed memory allocation failure introduced in fc8d1b125cef. Found by Coverity (CID 1529969). --- diff --git a/src/njs_builtin.c b/src/njs_builtin.c index 854f9c8f..317458e0 100644 --- a/src/njs_builtin.c +++ b/src/njs_builtin.c @@ -756,7 +756,7 @@ njs_object_completions(njs_vm_t *vm, njs_value_t *object, njs_str_t *expression) completion->length = (prefix - expression->start) + key.length + 1; completion->start = njs_mp_alloc(vm->mem_pool, completion->length); - if (completion == NULL) { + if (njs_slow_path(completion->start == NULL)) { njs_arr_destroy(array); array = NULL; goto done;