log-context: Don't add log context if value is NULL

This avoids if conditions at the callsite which mess up stack based
lifetimes.
This commit is contained in:
Daan De Meyer
2025-11-05 23:45:30 +01:00
parent 5cf894ad58
commit bc8aebdce9

View File

@@ -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)