[njs] Fixed njs_vmcode_restart().

Dmitry Volyntsev xeioex at nginx.com
Thu Apr 25 16:50:39 UTC 2019


details:   https://hg.nginx.org/njs/rev/9ca942bc0792
branches:  
changeset: 928:9ca942bc0792
user:      hongzhidao <hongzhidao at gmail.com>
date:      Thu Apr 25 15:56:44 2019 +0300
description:
Fixed njs_vmcode_restart().

diffstat:

 njs/njs_vm.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (30 lines):

diff -r 793161f2708c -r 9ca942bc0792 njs/njs_vm.c
--- a/njs/njs_vm.c	Thu Apr 25 15:50:03 2019 +0300
+++ b/njs/njs_vm.c	Thu Apr 25 15:56:44 2019 +0300
@@ -2852,17 +2852,21 @@ njs_vmcode_restart(njs_vm_t *vm, njs_val
 
     ret = vmcode->code.operation(vm, value1, &frame->trap_values[1]);
 
+    if (nxt_slow_path(ret == NJS_ERROR)) {
+        return ret;
+    }
+
     if (nxt_slow_path(ret == NJS_TRAP)) {
         /* Trap handlers are not reentrant. */
         njs_internal_error(vm, "trap inside restart instruction");
         return NXT_ERROR;
     }
 
-    retval = njs_vmcode_operand(vm, vmcode->operand1);
-
-    njs_release(vm, retval);
-
-    *retval = vm->retval;
+    if (vmcode->code.retval) {
+        retval = njs_vmcode_operand(vm, vmcode->operand1);
+        njs_release(vm, retval);
+        *retval = vm->retval;
+    }
 
     return ret;
 }


More information about the nginx-devel mailing list