teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0045-journal-remote-fix-memleak-of-the-name-of-the-remote.patch

Zbigniew Jędrzejewski-Szmek f4a676
From d56ab41b58a760907c5fda19b79bcb01aa9611d8 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek f4a676
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Zbigniew Jędrzejewski-Szmek f4a676
Date: Sat, 13 May 2017 22:42:14 -0400
Zbigniew Jędrzejewski-Szmek f4a676
Subject: [PATCH] journal-remote: fix memleak of the name of the remote source
Zbigniew Jędrzejewski-Szmek f4a676
Zbigniew Jędrzejewski-Szmek f4a676
(cherry picked from commit 2ddb70d26f9a284fbf38bca37ea857f24c3f39de)
Zbigniew Jędrzejewski-Szmek f4a676
---
Zbigniew Jędrzejewski-Szmek f4a676
 src/basic/journal-importer.c              | 1 +
Zbigniew Jędrzejewski-Szmek f4a676
 src/journal-remote/journal-remote-parse.c | 2 +-
Zbigniew Jędrzejewski-Szmek f4a676
 2 files changed, 2 insertions(+), 1 deletion(-)
Zbigniew Jędrzejewski-Szmek f4a676
Zbigniew Jędrzejewski-Szmek f4a676
diff --git a/src/basic/journal-importer.c b/src/basic/journal-importer.c
Zbigniew Jędrzejewski-Szmek f4a676
index 66119d2de1..7d72effdea 100644
Zbigniew Jędrzejewski-Szmek f4a676
--- a/src/basic/journal-importer.c
Zbigniew Jędrzejewski-Szmek f4a676
+++ b/src/basic/journal-importer.c
Zbigniew Jędrzejewski-Szmek f4a676
@@ -69,6 +69,7 @@ void journal_importer_cleanup(JournalImporter *imp) {
Zbigniew Jędrzejewski-Szmek f4a676
                 safe_close(imp->fd);
Zbigniew Jędrzejewski-Szmek f4a676
         }
Zbigniew Jędrzejewski-Szmek f4a676
 
Zbigniew Jędrzejewski-Szmek f4a676
+        free(imp->name);
Zbigniew Jędrzejewski-Szmek f4a676
         free(imp->buf);
Zbigniew Jędrzejewski-Szmek f4a676
         iovw_free_contents(&imp->iovw);
Zbigniew Jędrzejewski-Szmek f4a676
 }
Zbigniew Jędrzejewski-Szmek f4a676
diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c
Zbigniew Jędrzejewski-Szmek f4a676
index 79afe6604c..d61d1c18f6 100644
Zbigniew Jędrzejewski-Szmek f4a676
--- a/src/journal-remote/journal-remote-parse.c
Zbigniew Jędrzejewski-Szmek f4a676
+++ b/src/journal-remote/journal-remote-parse.c
Zbigniew Jędrzejewski-Szmek f4a676
@@ -41,7 +41,7 @@ void source_free(RemoteSource *source) {
Zbigniew Jędrzejewski-Szmek f4a676
 
Zbigniew Jędrzejewski-Szmek f4a676
 /**
Zbigniew Jędrzejewski-Szmek f4a676
  * Initialize zero-filled source with given values. On success, takes
Zbigniew Jędrzejewski-Szmek f4a676
- * ownerhship of fd and writer, otherwise does not touch them.
Zbigniew Jędrzejewski-Szmek f4a676
+ * ownership of fd, name, and writer, otherwise does not touch them.
Zbigniew Jędrzejewski-Szmek f4a676
  */
Zbigniew Jędrzejewski-Szmek f4a676
 RemoteSource* source_new(int fd, bool passive_fd, char *name, Writer *writer) {
Zbigniew Jędrzejewski-Szmek f4a676