From a85fbea5bbc2f40c4151d8947d7039f2c21d565a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 21 Feb 2022 10:53:32 +0100 Subject: test build for upstream patch --- unit-github639.patch | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 unit-github639.patch (limited to 'unit-github639.patch') diff --git a/unit-github639.patch b/unit-github639.patch new file mode 100644 index 0000000..a06e79c --- /dev/null +++ b/unit-github639.patch @@ -0,0 +1,55 @@ +# HG changeset patch +# User Zhidao HONG +# Date 1645410293 -28800 +# Mon Feb 21 10:24:53 2022 +0800 +# Node ID 5419d81ccd877b80249bfee71e37b122a68eda6d +# Parent 00faecc2c4b6ad1bddb5b4d083e415851e9f93b1 +Improved realloc() wrapper. + +This closes #639 issue on Github. + +diff -r 00faecc2c4b6 -r 5419d81ccd87 src/nxt_malloc.c +--- a/src/nxt_malloc.c Tue Feb 15 21:43:02 2022 +0000 ++++ b/src/nxt_malloc.c Mon Feb 21 10:24:53 2022 +0800 +@@ -61,6 +61,33 @@ nxt_zalloc(size_t size) + } + + ++#if (NXT_DEBUG) ++ ++void * ++nxt_realloc(void *p, size_t size) ++{ ++ void *n; ++ uintptr_t ptr; ++ ++ ptr = (uintptr_t) p; ++ ++ n = realloc(p, size); ++ ++ if (nxt_fast_path(n != NULL)) { ++ nxt_log_debug(nxt_malloc_log(), "realloc(%p, %uz): %p", ptr, size, n); ++ ++ } else { ++ nxt_log_alert_moderate(&nxt_malloc_log_moderation, nxt_malloc_log(), ++ "realloc(%p, %uz) failed %E", ++ ptr, size, nxt_errno); ++ } ++ ++ return n; ++} ++ ++ ++#else ++ + void * + nxt_realloc(void *p, size_t size) + { +@@ -80,6 +107,8 @@ nxt_realloc(void *p, size_t size) + return n; + } + ++#endif /* NXT_DEBUG */ ++ + + /* nxt_lvlhsh_* functions moved here to avoid references from nxt_lvlhsh.c. */ -- cgit