[njs] Added return value check forgotten in 9beb9ea093b5.

Alexander Borisov alexander.borisov at nginx.com
Fri May 29 11:50:47 UTC 2020


details:   https://hg.nginx.org/njs/rev/1d071c0e23e8
branches:  
changeset: 1406:1d071c0e23e8
user:      Alexander Borisov <alexander.borisov at nginx.com>
date:      Fri May 29 14:49:36 2020 +0300
description:
Added return value check forgotten in 9beb9ea093b5.

Found by Coverity (CID 1463859, 1463860).

diffstat:

 src/njs_json.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (24 lines):

diff -r 9beb9ea093b5 -r 1d071c0e23e8 src/njs_json.c
--- a/src/njs_json.c	Wed May 27 18:18:40 2020 +0300
+++ b/src/njs_json.c	Fri May 29 14:49:36 2020 +0300
@@ -1037,12 +1037,16 @@ njs_json_parse_iterator_call(njs_vm_t *v
         }
 
         if (njs_is_undefined(&parse->retval)) {
-            njs_value_property_i64_delete(vm, &state->value, state->index - 1,
-                                          NULL);
+            ret = njs_value_property_i64_delete(vm, &state->value,
+                                                state->index - 1, NULL);
 
         } else {
-            njs_value_property_i64_set(vm, &state->value, state->index - 1,
-                                       &parse->retval);
+            ret = njs_value_property_i64_set(vm, &state->value,
+                                             state->index - 1, &parse->retval);
+        }
+
+        if (njs_slow_path(ret == NJS_ERROR)) {
+            return NJS_ERROR;
         }
 
         break;


More information about the nginx-devel mailing list