[njs] Fixed allocation failure detection in njs_backtrace_to_string().

Dmitry Volyntsev xeioex at nginx.com
Tue Jan 26 12:52:59 UTC 2021


details:   https://hg.nginx.org/njs/rev/60d363cb92b3
branches:  
changeset: 1595:60d363cb92b3
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue Jan 26 12:52:15 2021 +0000
description:
Fixed allocation failure detection in njs_backtrace_to_string().

Found by Coverity (CID 1472503).

diffstat:

 src/njs_error.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r d64c77837095 -r 60d363cb92b3 src/njs_error.c
--- a/src/njs_error.c	Tue Jan 26 12:52:12 2021 +0000
+++ b/src/njs_error.c	Tue Jan 26 12:52:15 2021 +0000
@@ -1226,6 +1226,7 @@ njs_backtrace_to_string(njs_vm_t *vm, nj
 {
     size_t                 count;
     njs_chb_t              chain;
+    njs_int_t              ret;
     njs_uint_t             i;
     njs_backtrace_entry_t  *be, *prev;
 
@@ -1271,8 +1272,8 @@ njs_backtrace_to_string(njs_vm_t *vm, nj
         be++;
     }
 
-    njs_chb_join(&chain, dst);
+    ret = njs_chb_join(&chain, dst);
     njs_chb_destroy(&chain);
 
-    return NJS_OK;
+    return ret;
 }


More information about the nginx-devel mailing list