diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-11-01 22:33:26 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-11-01 23:08:21 +0100 |
commit | 1d3e682e124c283be367a4db55b73d491eeb48dc (patch) | |
tree | 85e41886444986efc1e499b29ea981c9e0c5fad6 | |
parent | ac097c841e05bcc96da7f369682b56164671eec8 (diff) | |
download | systemd-1d3e682e124c283be367a4db55b73d491eeb48dc.tar.gz |
journald: unitialized variable access
../src/journal/journald-native.c:341:13: warning: variable 'context' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (ucred && pid_is_valid(ucred->pid)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/journal/journald-native.c:350:42: note: uninitialized use occurs here
context, ucred, tv, label, label_len);
^~~~~~~
../src/journal/journald-native.c:335:31: note: initialize the variable 'context' to silence this warning
ClientContext *context;
^
= NULL
Very nice reporting!
Functions that we call can handle context == NULL, so it's enough to simply
initialize the variable.
-rw-r--r-- | src/journal/journald-native.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index d45c9c2270..1ff4e29849 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -332,7 +332,7 @@ void server_process_native_message( const char *label, size_t label_len) { size_t remaining = buffer_size; - ClientContext *context; + ClientContext *context = NULL; int r; assert(s); |