From: Daan De Meyer Date: Thu, 3 Aug 2023 20:38:10 +0000 (+0200) Subject: tree-wide: Fix -Wmaybe-uninitialized compilation warnings X-Git-Tag: v255-rc1~827 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7e48f3ba71614604e2b7fbb5bcfdb1c848600e89;p=thirdparty%2Fsystemd.git tree-wide: Fix -Wmaybe-uninitialized compilation warnings --- diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index 7946e6c120b..7f23d1e1586 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -602,7 +602,7 @@ static int fs_validate( sd_id128_t *ret_found_uuid) { _cleanup_free_ char *fstype = NULL; - sd_id128_t u; + sd_id128_t u = SD_ID128_NULL; /* avoid false maybe-unitialized warning */ int r; assert(dm_node); diff --git a/src/libudev/test-libudev.c b/src/libudev/test-libudev.c index 839a6a1a742..e05a062c8e8 100644 --- a/src/libudev/test-libudev.c +++ b/src/libudev/test-libudev.c @@ -171,7 +171,7 @@ static int enumerate_print_list(struct udev_enumerate *enumerate) { } static void test_monitor(struct udev *udev) { - _cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor; + _cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor = NULL; _cleanup_close_ int fd_ep = -EBADF; int fd_udev; struct epoll_event ep_udev = { diff --git a/src/test/test-core-unit.c b/src/test/test-core-unit.c index 1a08507d1d6..dc108cc2efe 100644 --- a/src/test/test-core-unit.c +++ b/src/test/test-core-unit.c @@ -11,8 +11,8 @@ static void test_unit_escape_setting_one( const char *expected_exec, const char *expected_c) { - _cleanup_free_ char *a = NULL, *b, *c, *d, - *s_esc, *a_esc, *b_esc, *c_esc, *d_esc; + _cleanup_free_ char *a = NULL, *b = NULL, *c = NULL, *d = NULL, + *s_esc = NULL, *a_esc = NULL, *b_esc = NULL, *c_esc = NULL, *d_esc = NULL; const char *t; if (!expected_exec_env) @@ -66,8 +66,8 @@ static void test_unit_concat_strv_one( const char *expected_exec, const char *expected_c) { - _cleanup_free_ char *a, *b, *c, *d, - *s_ser, *s_esc, *a_esc, *b_esc, *c_esc, *d_esc; + _cleanup_free_ char *a = NULL, *b = NULL, *c = NULL, *d = NULL, + *s_ser = NULL, *s_esc = NULL, *a_esc = NULL, *b_esc = NULL, *c_esc = NULL, *d_esc = NULL; assert_se(s_ser = strv_join(s, "_")); assert_se(s_esc = cescape(s_ser)); diff --git a/src/test/test-ellipsize.c b/src/test/test-ellipsize.c index 40edc289e9d..c272c561d29 100644 --- a/src/test/test-ellipsize.c +++ b/src/test/test-ellipsize.c @@ -137,7 +137,7 @@ TEST(ellipsize_ansi) { } TEST(ellipsize_ansi_cats) { - _cleanup_free_ char *e, *f, *g, *h; + _cleanup_free_ char *e = NULL, *f = NULL, *g = NULL, *h = NULL; /* Make sure we don't cut off in the middle of an ANSI escape sequence. */ diff --git a/src/test/test-mempress.c b/src/test/test-mempress.c index e03f9b533b8..c11a55a67e1 100644 --- a/src/test/test-mempress.c +++ b/src/test/test-mempress.c @@ -260,7 +260,7 @@ TEST(real_pressure) { assert_se(sd_event_source_set_memory_pressure_period(es, 70 * USEC_PER_MSEC, USEC_PER_SEC) == 0); assert_se(sd_event_source_set_enabled(es, SD_EVENT_ONESHOT) >= 0); - _cleanup_free_ char *uo; + _cleanup_free_ char *uo = NULL; assert_se(uo = unit_dbus_path_from_name(scope)); uint64_t mcurrent = UINT64_MAX;