summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-09-13 08:15:38 +0200
committerThomas Haller <thaller@redhat.com>2017-09-13 08:17:30 +0200
commit121321542e2e0b36ef5dc3b1094b3225b2013ce8 (patch)
tree28dc1988a7efbf9c3fad21e8c7ee4f2c7394384c
parent789f8a6b51ebdd7cb6ba5c902c02e5a44a71ed68 (diff)
downloadNetworkManager-121321542e2e0b36ef5dc3b1094b3225b2013ce8.tar.gz
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: 28a062748180534445b3996862c60de330d48dbf
-rw-r--r--libnm-core/nm-utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index 9133af57d3..0ef64ff392 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -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)