[network-manager-applet/th/tmp: 2/5] applet: avoid compiler warning about uninitialized variable in info_dialog_add_page()



commit 02a78b25ed11e4bdb80c1fc551b3b1e02a56036f
Author: Thomas Haller <thaller redhat com>
Date:   Thu Mar 5 12:13:33 2020 +0100

    applet: avoid compiler warning about uninitialized variable in info_dialog_add_page()
    
    It's a false positive. Avoid it.
    
      ../src/applet-dialogs.c: In function applet_info_dialog_show:
      ../src/applet-dialogs.c:709:21: warning: ip6_config may be used uninitialized in this function 
[-Wmaybe-uninitialized]
        709 |  dns6 = def6_addr ? nm_ip_config_get_nameservers (ip6_config) : NULL;
            |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../src/applet-dialogs.c:481:14: note: ip6_config was declared here
        481 |  NMIPConfig *ip6_config;
            |              ^~~~~~~~~~

 src/applet-dialogs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c
index 88d32a64..b89d592b 100644
--- a/src/applet-dialogs.c
+++ b/src/applet-dialogs.c
@@ -478,7 +478,7 @@ info_dialog_add_page (GtkNotebook *notebook,
        char *str;
        const char *iface, *method = NULL;
        NMIPConfig *ip4_config;
-       NMIPConfig *ip6_config;
+       NMIPConfig *ip6_config = NULL;
        const char * const *dns;
        const char * const *dns6;
        NMIPAddress *def_addr = NULL;
@@ -676,7 +676,6 @@ info_dialog_add_page (GtkNotebook *notebook,
                gtk_grid_attach (grid, create_info_group_label (_("IPv6"), FALSE), 0, row, 2, 1);
                row++;
 
-               addresses = NULL;
                ip6_config = nm_device_get_ip6_config (device);
                if (ip6_config) {
                        addresses = nm_ip_config_get_addresses (ip6_config);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]