platform: fix compilation without LTO

Fix the following error seen when running the build_clean.sh script
with LTO disabled:

  In file included from ../src/libnm-glib-aux/nm-default-glib.h:66,
                   from ../src/libnm-glib-aux/nm-default-glib-i18n-prog.h:13,
                   from ../src/core/nm-default-daemon.h:11,
                   from ../src/core/platform/tests/test-link.c:6:
  In function ‘_nm_auto_freev’,
      inlined from ‘test_link_get_bridge_fdb’ at ../src/core/platform/tests/test-link.c:2732:33:
  ../src/libnm-glib-aux/nm-macros-internal.h:166:8: error: ‘addrs’ may be used uninitialized [-Werror=maybe-uninitialized]
    166 |     if (*p) {
        |        ^
  ../src/core/platform/tests/test-link.c: In function ‘test_link_get_bridge_fdb’:
  ../src/core/platform/tests/test-link.c:2732:33: note: ‘addrs’ was declared here
   2732 |     nm_auto_freev NMEtherAddr **addrs;
        |                                 ^~~~~
  cc1: all warnings being treated as errors

Fixes: 16ef33d380 ('bond-slb: fix memory leak')
This commit is contained in:
Beniamino Galvani
2025-07-17 10:28:27 +02:00
parent bd41951f1d
commit b4a22ad2a9

View File

@@ -2729,7 +2729,7 @@ static void
test_link_get_bridge_fdb(void) test_link_get_bridge_fdb(void)
{ {
const NMPlatformLink *link; const NMPlatformLink *link;
nm_auto_freev NMEtherAddr **addrs; nm_auto_freev NMEtherAddr **addrs = NULL;
int ifindex[2]; int ifindex[2];
guint8 expected[][6] = { guint8 expected[][6] = {
{0x00, 0x99, 0x00, 0x00, 0x00, 0x01}, {0x00, 0x99, 0x00, 0x00, 0x00, 0x01},