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:
Philippe De Swert
2014-09-11 17:13:59 +02:00
committed by David Herrmann
parent fd989a0bc9
commit 48d4c7468f
+1 -2
View File
@@ -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;
}