From 48d4c7468fb5003ae45ac834de1ca85624cdd56e Mon Sep 17 00:00:00 2001 From: Philippe De Swert Date: Wed, 10 Sep 2014 12:20:39 +0300 Subject: [PATCH] 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 --- src/journal/coredumpctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c index f5cf85a76..34dcae87c 100644 --- a/src/journal/coredumpctl.c +++ b/src/journal/coredumpctl.c @@ -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; } -- 2.30.2