[njs] Fixed alignment of njs_object_prop_t in njs_method_private_copy().

Valentin Bartenev vbart at nginx.com
Mon May 6 14:47:37 UTC 2019


details:   https://hg.nginx.org/njs/rev/6ee0e7a44e79
branches:  
changeset: 948:6ee0e7a44e79
user:      Valentin Bartenev <vbart at nginx.com>
date:      Mon May 06 17:47:26 2019 +0300
description:
Fixed alignment of njs_object_prop_t in njs_method_private_copy().

It must be aligned to njs_value_t.

diffstat:

 njs/njs_object.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r f3b145f3ca34 -r 6ee0e7a44e79 njs/njs_object.c
--- a/njs/njs_object.c	Mon May 06 05:07:51 2019 +0300
+++ b/njs/njs_object.c	Mon May 06 17:47:26 2019 +0300
@@ -773,7 +773,8 @@ njs_method_private_copy(njs_vm_t *vm, nj
     njs_function_t     *function;
     njs_object_prop_t  *prop, *shared;
 
-    prop = nxt_mp_alloc(vm->mem_pool, sizeof(njs_object_prop_t));
+    prop = nxt_mp_align(vm->mem_pool, sizeof(njs_value_t),
+                        sizeof(njs_object_prop_t));
     if (nxt_slow_path(prop == NULL)) {
         njs_memory_error(vm);
         return NXT_ERROR;


More information about the nginx-devel mailing list