summaryrefslogtreecommitdiffstats
path: root/unit-github639.patch
diff options
context:
space:
mode:
Diffstat (limited to 'unit-github639.patch')
-rw-r--r--unit-github639.patch55
1 files changed, 55 insertions, 0 deletions
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 <z.hong@f5.com>
+# 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. */