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/journal-remote | |
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/journal-remote')
-rw-r--r-- | src/journal-remote/journal-gatewayd.c | 2 | ||||
-rw-r--r-- | src/journal-remote/journal-remote.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 4cefe3918c..a2f166a881 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -311,7 +311,7 @@ static int request_parse_range( colon2 = strchr(colon + 1, ':'); if (colon2) { - _cleanup_free_ char *t; + _cleanup_free_ char *t = NULL; t = strndup(colon + 1, colon2 - colon - 1); if (!t) diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 6f71248aaf..9600e5f732 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -40,7 +40,7 @@ static int open_output(RemoteServer *s, Writer *w, const char* host) { break; case JOURNAL_WRITE_SPLIT_HOST: { - _cleanup_free_ char *name; + _cleanup_free_ char *name = NULL; assert(host); |