From: Philippe De Swert Date: Wed, 10 Sep 2014 09:20:39 +0000 (+0300) Subject: journal: do not dereference already freed patterns X-Git-Tag: v217~598 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=48d4c7468fb5003ae45ac834de1ca85624cdd56e;ds=sidebyside 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 --- 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; }