ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Blob Blame History Raw
From d56ab41b58a760907c5fda19b79bcb01aa9611d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 13 May 2017 22:42:14 -0400
Subject: [PATCH] journal-remote: fix memleak of the name of the remote source

(cherry picked from commit 2ddb70d26f9a284fbf38bca37ea857f24c3f39de)
---
 src/basic/journal-importer.c              | 1 +
 src/journal-remote/journal-remote-parse.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/basic/journal-importer.c b/src/basic/journal-importer.c
index 66119d2de1..7d72effdea 100644
--- a/src/basic/journal-importer.c
+++ b/src/basic/journal-importer.c
@@ -69,6 +69,7 @@ void journal_importer_cleanup(JournalImporter *imp) {
                 safe_close(imp->fd);
         }
 
+        free(imp->name);
         free(imp->buf);
         iovw_free_contents(&imp->iovw);
 }
diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c
index 79afe6604c..d61d1c18f6 100644
--- a/src/journal-remote/journal-remote-parse.c
+++ b/src/journal-remote/journal-remote-parse.c
@@ -41,7 +41,7 @@ void source_free(RemoteSource *source) {
 
 /**
  * Initialize zero-filled source with given values. On success, takes
- * ownerhship of fd and writer, otherwise does not touch them.
+ * ownership of fd, name, and writer, otherwise does not touch them.
  */
 RemoteSource* source_new(int fd, bool passive_fd, char *name, Writer *writer) {