[njs] Improved njs_mp_free() to aling with free() semantics.

Dmitry Volyntsev xeioex at nginx.com
Thu Sep 8 17:43:12 UTC 2022


details:   https://hg.nginx.org/njs/rev/4689935e5d36
branches:  
changeset: 1950:4689935e5d36
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Sep 08 10:03:25 2022 -0700
description:
Improved njs_mp_free() to aling with free() semantics.

Previously, njs_mp_free() issued an assertion when p == NULL, while NULL
argument is explicitly allowed for free().

diffstat:

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

diffs (12 lines):

diff -r a2db32044812 -r 4689935e5d36 src/njs_mp.c
--- a/src/njs_mp.c	Tue Sep 06 18:44:47 2022 -0700
+++ b/src/njs_mp.c	Thu Sep 08 10:03:25 2022 -0700
@@ -682,7 +682,7 @@ njs_mp_free(njs_mp_t *mp, void *p)
         }
 
     } else {
-        njs_assert_msg(0, "freed pointer is out of mp: %p\n", p);
+        njs_assert_msg(p == NULL, "freed pointer is out of mp: %p\n", p);
     }
 }
 



More information about the nginx-devel mailing list