From: Willy Tarreau Date: Thu, 23 Jan 2020 10:47:13 +0000 (+0100) Subject: CLEANUP: stats: shut up a wrong null-deref warning from gcc 9.2 X-Git-Tag: v2.2-dev2~101 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=027d206b57bec59397eb6fb23f8ff4e3a2edb2e1;p=thirdparty%2Fhaproxy.git CLEANUP: stats: shut up a wrong null-deref warning from gcc 9.2 As reported in bug #447, gcc 9.2 invents impossible code paths and then complains that we don't check for our pointers to be NULL... This code path is not critical, better add the test to shut it up than try to help it being less creative. This code hasn't changed for a while, so it could help distros to backport this to older releases. --- diff --git a/src/stats.c b/src/stats.c index 6330512ca8..f8a15bd547 100644 --- a/src/stats.c +++ b/src/stats.c @@ -2411,7 +2411,7 @@ static void stats_dump_html_head(struct appctx *appctx, struct uri_auth *uri) "-->\n" "\n", (appctx->ctx.stats.flags & STAT_SHNODE) ? " on " : "", - (appctx->ctx.stats.flags & STAT_SHNODE) ? (uri->node ? uri->node : global.node) : "" + (appctx->ctx.stats.flags & STAT_SHNODE) ? (uri && uri->node ? uri->node : global.node) : "" ); }