diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-04-12 23:10:21 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-04-14 12:25:06 +0100 |
commit | c2b2df604b845b4e1697d0911935e6644323c5a6 (patch) | |
tree | 010d290588b55b7ed97f9e3066f56f9a9d08d77d /src/sysv-generator | |
parent | be084c0dd1f1a06320e507c0e6a9de23b37556e1 (diff) | |
download | systemd-c2b2df604b845b4e1697d0911935e6644323c5a6.tar.gz |
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/sysv-generator')
-rw-r--r-- | src/sysv-generator/sysv-generator.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c index 8c7aef23c3..cef141fbac 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c @@ -137,7 +137,7 @@ static int generate_unit_file(SysvStub *s) { path_escaped); if (s->description) { - _cleanup_free_ char *t; + _cleanup_free_ char *t = NULL; t = specifier_escape(s->description); if (!t) @@ -165,7 +165,7 @@ static int generate_unit_file(SysvStub *s) { yes_no(!s->pid_file)); if (s->pid_file) { - _cleanup_free_ char *t; + _cleanup_free_ char *t = NULL; t = specifier_escape(s->pid_file); if (!t) @@ -419,7 +419,7 @@ static int handle_dependencies(SysvStub *s, unsigned line, const char *full_text } static int load_sysv(SysvStub *s) { - _cleanup_fclose_ FILE *f; + _cleanup_fclose_ FILE *f = NULL; unsigned line = 0; int r; enum { |