From: Daan De Meyer Date: Wed, 5 Nov 2025 22:45:30 +0000 (+0100) Subject: log-context: Don't add log context if value is NULL X-Git-Tag: v259-rc1~59^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc8aebdce951d30b4ca1e7e1e7d3f5e0cf468f46;p=thirdparty%2Fsystemd.git log-context: Don't add log context if value is NULL This avoids if conditions at the callsite which mess up stack based lifetimes. --- diff --git a/src/basic/log-context.c b/src/basic/log-context.c index 27bce6f1f61..334fe95fc34 100644 --- a/src/basic/log-context.c +++ b/src/basic/log-context.c @@ -58,7 +58,9 @@ static LogContext* log_context_detach(LogContext *c) { LogContext* log_context_new(const char *key, const char *value) { assert(key); assert(endswith(key, "=")); - assert(value); + + if (!value) + return NULL; LIST_FOREACH(ll, i, _log_context) if (i->key == key && i->value == value)