summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe De Swert <philippedeswert@gmail.com>2014-09-10 12:20:39 +0300
committerDavid Herrmann <dh.herrmann@gmail.com>2014-09-11 17:13:59 +0200
commit48d4c7468fb5003ae45ac834de1ca85624cdd56e (patch)
tree80c019d1815a8b588d6b62fa276d45d6fa3c37fa
parentfd989a0bc999d79719408ac28b126d9c9016bcb5 (diff)
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
-rw-r--r--src/journal/coredumpctl.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index f5cf85a765..34dcae87c0 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;
}