From a9b66e254cb036592cbe2eed87eb41096e215d53 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 2 Jul 2025 16:32:43 +0200 Subject: [PATCH] nmcli: fix compile error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Running the build script with LTO disabled ("contrib/fedora/rpm/build_clean.sh -W lto") gives the following error: In file included from ../src/libnm-std-aux/nm-default-std.h:102, from ../src/libnm-glib-aux/nm-default-glib.h:11, from ../src/libnm-glib-aux/nm-default-glib-i18n-lib.h:13, from ../src/libnm-client-aux-extern/nm-default-client.h:11, from ../src/nmcli/connections.c:6: In function ‘_nm_auto_unref_ptrarray’, inlined from ‘do_connection_add’ at ../src/nmcli/connections.c:6069:35: ../src/libnm-std-aux/nm-std-aux.h:1106:12: error: ‘props’ may be used uninitialized [-Werror=maybe-uninitialized] 1106 | if (*v) \ | ^ ../src/libnm-glib-aux/nm-macros-internal.h:91:1: note: in expansion of macro ‘NM_AUTO_DEFINE_FCN0’ 91 | NM_AUTO_DEFINE_FCN0(GPtrArray *, _nm_auto_unref_ptrarray, g_ptr_array_unref); | ^~~~~~~~~~~~~~~~~~~ ../src/nmcli/connections.c: In function ‘do_connection_add’: ../src/nmcli/connections.c:6069:35: note: ‘props’ was declared here 6069 | gs_unref_ptrarray GPtrArray *props; | ^~~~~ cc1: all warnings being treated as errors Fix it. Fixes: bb850fda0ed9 ('nmcli: connection: process port-type, type and controller first') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2236 --- src/nmcli/connections.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index 409f80673..3f884bc51 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -6066,7 +6066,7 @@ nmc_add_connection(NmCli *nmc, NMConnection *connection, gboolean temporary) static void do_connection_add(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv) { - gs_unref_ptrarray GPtrArray *props; + gs_unref_ptrarray GPtrArray *props = NULL; gs_unref_object NMConnection *connection = NULL; NMSettingConnection *s_con; gs_free_error GError *error = NULL;