diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-04-13 00:10:21 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-04-14 13:25:06 +0200 |
commit | c2b2df604b845b4e1697d0911935e6644323c5a6 (patch) | |
tree | 010d290588b55b7ed97f9e3066f56f9a9d08d77d /src/machine/machine.c | |
parent | meson: build tests with -Wno-maybe-uninitialized if -O2/-flto are used (diff) | |
download | systemd-c2b2df604b845b4e1697d0911935e6644323c5a6.tar.xz systemd-c2b2df604b845b4e1697d0911935e6644323c5a6.zip |
tree-wide: avoid uninitialized warning on _cleanup_ variables
With some versions of the compiler, the _cleanup_ attr makes it think
the variable might be freed/closed when uninitialized, even though it
cannot happen. The added cost is small enough to be worth the benefit,
and optimized builds will help reduce it even further.
Diffstat (limited to 'src/machine/machine.c')
-rw-r--r-- | src/machine/machine.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/machine/machine.c b/src/machine/machine.c index 537b0cd779..6215b29c27 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -134,7 +134,7 @@ int machine_save(Machine *m) { m->name); if (m->unit) { - _cleanup_free_ char *escaped; + _cleanup_free_ char *escaped = NULL; escaped = cescape(m->unit); if (!escaped) { @@ -149,7 +149,7 @@ int machine_save(Machine *m) { fprintf(f, "SCOPE_JOB=%s\n", m->scope_job); if (m->service) { - _cleanup_free_ char *escaped; + _cleanup_free_ char *escaped = NULL; escaped = cescape(m->service); if (!escaped) { @@ -160,7 +160,7 @@ int machine_save(Machine *m) { } if (m->root_directory) { - _cleanup_free_ char *escaped; + _cleanup_free_ char *escaped = NULL; escaped = cescape(m->root_directory); if (!escaped) { |