dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
Blob Blame History Raw
From f1a8d50c069f57f0b9d23c81e50686bc8a2e43b7 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 10 Dec 2013 19:51:47 +0000
Subject: [PATCH] journald: use a bit more cleanup magic!

---
 src/journal/journald-stream.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index 4080622..771a2bd 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -75,7 +75,7 @@ struct StdoutStream {
 
 static int stdout_stream_log(StdoutStream *s, const char *p) {
         struct iovec iovec[N_IOVEC_META_FIELDS + 5];
-        char *message = NULL, *syslog_priority = NULL, *syslog_facility = NULL, *syslog_identifier = NULL;
+        _cleanup_free_ char *message = NULL, *syslog_priority = NULL, *syslog_facility = NULL, *syslog_identifier = NULL;
         unsigned n = 0;
         int priority;
         char *label = NULL;
@@ -128,12 +128,6 @@ static int stdout_stream_log(StdoutStream *s, const char *p) {
 #endif
 
         server_dispatch_message(s->server, iovec, n, ELEMENTSOF(iovec), &s->ucred, NULL, label, label_len, s->unit_id, priority, 0);
-
-        free(message);
-        free(syslog_priority);
-        free(syslog_facility);
-        free(syslog_identifier);
-
         return 0;
 }