journal: do not dereference already freed patterns
In case set_consume goes wrong, the pattern name has already been freed. So we do not try to print it in the logs, assuming the pattern addition print will be printed just before the failure anyway. Found with coverity. Fixes: CID#1237798
This commit is contained in:
committed by
David Herrmann
parent
fd989a0bc9
commit
48d4c7468f
@@ -110,8 +110,7 @@ static int add_match(Set *set, const char *match) {
|
||||
log_debug("Adding pattern: %s", pattern);
|
||||
r = set_consume(set, pattern);
|
||||
if (r < 0) {
|
||||
log_error("Failed to add pattern '%s': %s",
|
||||
pattern, strerror(-r));
|
||||
log_error("Failed to add pattern: %s", strerror(-r));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user