summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--unit-gcc12.patch12
-rw-r--r--unit-github639.patch55
-rw-r--r--unit.spec7
3 files changed, 60 insertions, 14 deletions
diff --git a/unit-gcc12.patch b/unit-gcc12.patch
deleted file mode 100644
index f62ea5d..0000000
--- a/unit-gcc12.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up ./src/nxt_malloc.c.old ./src/nxt_malloc.c
---- ./src/nxt_malloc.c.old 2022-02-11 15:39:10.953121985 +0100
-+++ ./src/nxt_malloc.c 2022-02-11 15:39:14.419109057 +0100
-@@ -61,6 +61,8 @@ nxt_zalloc(size_t size)
- }
-
-
-+# pragma GCC diagnostic ignored "-Wuse-after-free"
-+
- void *
- nxt_realloc(void *p, size_t size)
- {
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. */
diff --git a/unit.spec b/unit.spec
index eb99906..a5223c7 100644
--- a/unit.spec
+++ b/unit.spec
@@ -17,7 +17,7 @@
Name: unit
Summary: NGINX Unit application server
Version: 1.26.1
-Release: 2%{?dist}
+Release: 3%{?dist}
License: ASL 2.0
URL: https://unit.nginx.org/
@@ -35,7 +35,7 @@ Patch0: %{project}-syspol.patch
Patch1: %{project}-openssl3.patch
# Woraroung use-afer-free
# https://github.com/nginx/unit/issues/639
-Patch2: %{project}-gcc12.patch
+Patch2: %{project}-github639.patch
BuildRequires: make
BuildRequires: gcc
@@ -195,6 +195,9 @@ BANNER
%changelog
+* Mon Feb 21 2022 Remi Collet <remi@remirepo.net> - 1.26.1-3
+- test build for upstream patch
+
* Fri Feb 11 2022 Remi Collet <remi@remirepo.net> - 1.26.1-2
- fix build error with GCC 12 using workaround to
https://github.com/nginx/unit/issues/639