From b954585c0b45305711c7f1dc75aa4064e2104058 Mon Sep 17 00:00:00 2001 From: Danilo Egea Gondolfo Date: Thu, 7 Nov 2024 16:28:42 +0000 Subject: [PATCH] parse: fix uninitialized variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the build on Fedora 41: In file included from /usr/include/glib-2.0/glib.h:117, from ../src/parse.c:25: In function ‘g_autoptr_cleanup_generic_gfree’, inlined from ‘get_ip_family’ at ../src/parse.c:1918:22: /usr/include/glib-2.0/glib/glib-autocleanups.h:32:3: error: ‘ip_str’ may be used uninitialized [-Werror=maybe-uninitialized] 32 | g_free (*pp); | ^~~~~~~~~~~~ ../src/parse.c: In function ‘get_ip_family’: ../src/parse.c:1918:22: note: ‘ip_str’ was declared here 1918 | g_autofree char *ip_str; | ^~~~~~ cc1: all warnings being treated as errors --- src/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse.c b/src/parse.c index ed5a038e6..eaa259192 100644 --- a/src/parse.c +++ b/src/parse.c @@ -1927,7 +1927,7 @@ handle_vxlan_tristate(NetplanParser* npp, yaml_node_t* node, const void* data, G STATIC int get_ip_family(const char* address) { - g_autofree char *ip_str; + g_autofree char *ip_str = NULL; char *prefix_len; ip_str = g_strdup(address);