mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 17:06:39 +09:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user