Workaround for the warning in nxt_realloc() on GCC 12.
This closes #639 issue on Github.
This commit is contained in:
@@ -31,6 +31,12 @@ NGINX Unit updated to 1.27.0.
|
|||||||
date="" time=""
|
date="" time=""
|
||||||
packager="Andrei Belov <defan@nginx.com>">
|
packager="Andrei Belov <defan@nginx.com>">
|
||||||
|
|
||||||
|
<change type="feature">
|
||||||
|
<para>
|
||||||
|
compatibility with GCC 12.
|
||||||
|
</para>
|
||||||
|
</change>
|
||||||
|
|
||||||
<change type="bugfix">
|
<change type="bugfix">
|
||||||
<para>
|
<para>
|
||||||
the controller process could crash when a chain with more than 4
|
the controller process could crash when a chain with more than 4
|
||||||
|
|||||||
@@ -64,17 +64,24 @@ nxt_zalloc(size_t size)
|
|||||||
void *
|
void *
|
||||||
nxt_realloc(void *p, size_t size)
|
nxt_realloc(void *p, size_t size)
|
||||||
{
|
{
|
||||||
void *n;
|
void *n;
|
||||||
|
uintptr_t ptr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Workaround for a warning on GCC 12 about using "p" pointer in debug log
|
||||||
|
* after realloc().
|
||||||
|
*/
|
||||||
|
ptr = (uintptr_t) p;
|
||||||
|
|
||||||
n = realloc(p, size);
|
n = realloc(p, size);
|
||||||
|
|
||||||
if (nxt_fast_path(n != NULL)) {
|
if (nxt_fast_path(n != NULL)) {
|
||||||
nxt_log_debug(nxt_malloc_log(), "realloc(%p, %uz): %p", p, size, n);
|
nxt_log_debug(nxt_malloc_log(), "realloc(%p, %uz): %p", ptr, size, n);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
nxt_log_alert_moderate(&nxt_malloc_log_moderation, nxt_malloc_log(),
|
nxt_log_alert_moderate(&nxt_malloc_log_moderation, nxt_malloc_log(),
|
||||||
"realloc(%p, %uz) failed %E",
|
"realloc(%p, %uz) failed %E",
|
||||||
p, size, nxt_errno);
|
ptr, size, nxt_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
|||||||
Reference in New Issue
Block a user