Skip to content

Commit

Permalink
parse: fix uninitialized variable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
daniloegea committed Nov 7, 2024
1 parent 2392ad4 commit 5606e32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,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);
Expand Down

0 comments on commit 5606e32

Please sign in to comment.