summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-08-01 09:10:50 +0200
committerTimm Bäder <mail@baedert.org>2020-08-01 09:10:50 +0200
commit6c3f367d2c3befbd6a294ed36ec3b25ddb8ebf90 (patch)
tree4f41a2540b9d274fe2f3c5c335c61a873a5166ee
parent7ce6a01f9967ded79183d3ad859244ce019b7203 (diff)
downloadglib-wip/baedert/timezone.tar.gz
timezone: Initialize a local variablewip/baedert/timezone
There is a "goto utf16_conv_failed" before in case subkey_w is NULL. In that case, we're calling g_free() on uninitialized memory. Fixes this compiler warning: ../subprojects/glib/glib/gtimezone.c:979:3: error: 'subkey_dynamic_w' may be used uninitialized in this function [-Werror=maybe-uninitialized] 979 | g_free (subkey_dynamic_w); | ^~~~~~~~~~~~~~~~~~~~~~~~~ Found in the gtk windows build.
-rw-r--r--glib/gtimezone.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/glib/gtimezone.c b/glib/gtimezone.c
index 7c1187371..8ee6186d7 100644
--- a/glib/gtimezone.c
+++ b/glib/gtimezone.c
@@ -829,7 +829,7 @@ rules_from_windows_time_zone (const gchar *identifier,
guint rules_num = 0;
RegTZI regtzi, regtzi_prev;
WCHAR winsyspath[MAX_PATH];
- gunichar2 *subkey_w, *subkey_dynamic_w;
+ gunichar2 *subkey_w, *subkey_dynamic_w = NULL;
if (GetSystemDirectoryW (winsyspath, MAX_PATH) == 0)
return 0;