libnm: fix uninitialized variable in get_system_encodings()

CC       libnm-core/libnm_core_libnm_core_la-nm-utils.lo
  libnm-core/nm-utils.c:210:6: error: variable 'encodings' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
          if (lang) {
              ^~~~
  libnm-core/nm-utils.c:220:7: note: uninitialized use occurs here
          if (!encodings) {
               ^~~~~~~~~
  libnm-core/nm-utils.c:210:2: note: remove the 'if' if its condition is always true
          if (lang) {
          ^~~~~~~~~~
  libnm-core/nm-utils.c:198:30: note: initialize the variable 'encodings' to silence this warning
          const char *const *encodings;
                                      ^
                                       = NULL

Fixes: 28a0627481
This commit is contained in:
Thomas Haller 2017-09-13 08:15:38 +02:00
parent 789f8a6b51
commit 121321542e

View file

@ -195,7 +195,7 @@ get_system_encodings (void)
{
static const char *const *cached_encodings;
static char *default_encodings[4];
const char *const *encodings;
const char *const *encodings = NULL;
char *lang;
if (cached_encodings)