summaryrefslogtreecommitdiffstats
path: root/src/test/test-nss-hosts.c
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-05-23 13:25:58 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2023-05-23 20:45:27 +0200
commit3d41b6b8e864abbf7b81c938532f42e97a900e22 (patch)
treea165aba13bdc0d7c0d3d6399292eefcdba834b65 /src/test/test-nss-hosts.c
parentjson: correctly handle magic strings when parsing variant strv (diff)
downloadsystemd-3d41b6b8e864abbf7b81c938532f42e97a900e22.tar.xz
systemd-3d41b6b8e864abbf7b81c938532f42e97a900e22.zip
tree-wide: Fix false positives on newer gcc
Recent gcc versions have started to trigger false positive maybe-uninitialized warnings. Let's make sure we initialize variables annotated with _cleanup_ to avoid these.
Diffstat (limited to 'src/test/test-nss-hosts.c')
-rw-r--r--src/test/test-nss-hosts.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/test-nss-hosts.c b/src/test/test-nss-hosts.c
index 2fbcde41d6..7758f0adc9 100644
--- a/src/test/test-nss-hosts.c
+++ b/src/test/test-nss-hosts.c
@@ -449,7 +449,7 @@ static int parse_argv(int argc, char **argv,
}
}
} else {
- _cleanup_free_ char *hostname;
+ _cleanup_free_ char *hostname = NULL;
assert_se(hostname = gethostname_malloc());
assert_se(names = strv_new("localhost", "_gateway", "_outbound", "foo_no_such_host", hostname));