summaryrefslogtreecommitdiffstats
path: root/src/journal-remote
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-04-13 00:10:21 +0200
committerLuca Boccassi <luca.boccassi@microsoft.com>2021-04-14 13:25:06 +0200
commitc2b2df604b845b4e1697d0911935e6644323c5a6 (patch)
tree010d290588b55b7ed97f9e3066f56f9a9d08d77d /src/journal-remote
parentmeson: build tests with -Wno-maybe-uninitialized if -O2/-flto are used (diff)
downloadsystemd-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.c2
-rw-r--r--src/journal-remote/journal-remote.c2
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);