valeriyvdovin / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0265-tmpfiles-fix-memory-leak-of-exclude_prefixes.patch

65878a
From 0ec33b41e2fddd714851b444d85c4bd8a4fae879 Mon Sep 17 00:00:00 2001
65878a
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
65878a
Date: Thu, 30 Jan 2014 21:40:27 -0500
65878a
Subject: [PATCH] tmpfiles: fix memory leak of exclude_prefixes
65878a
65878a
Missed in 5c795114.
65878a
65878a
(cherry picked from commit 498f8a39e66a62d015ac78e67e2504658bbba5f2)
65878a
65878a
Related: #1111199
65878a
---
65878a
 src/tmpfiles/tmpfiles.c | 7 ++++---
65878a
 1 file changed, 4 insertions(+), 3 deletions(-)
65878a
65878a
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
65878a
index 32f9088..1337d02 100644
65878a
--- a/src/tmpfiles/tmpfiles.c
65878a
+++ b/src/tmpfiles/tmpfiles.c
65878a
@@ -1332,12 +1332,12 @@ static int parse_argv(int argc, char *argv[]) {
65878a
                         break;
65878a
 
65878a
                 case ARG_PREFIX:
65878a
-                        if (strv_extend(&include_prefixes, optarg) < 0)
65878a
+                        if (strv_push(&include_prefixes, optarg) < 0)
65878a
                                 return log_oom();
65878a
                         break;
65878a
 
65878a
                 case ARG_EXCLUDE_PREFIX:
65878a
-                        if (strv_extend(&exclude_prefixes, optarg) < 0)
65878a
+                        if (strv_push(&exclude_prefixes, optarg) < 0)
65878a
                                 return log_oom();
65878a
                         break;
65878a
 
65878a
@@ -1498,7 +1498,8 @@ finish:
65878a
         hashmap_free(items);
65878a
         hashmap_free(globs);
65878a
 
65878a
-        strv_free(include_prefixes);
65878a
+        free(include_prefixes);
65878a
+        free(exclude_prefixes);
65878a
 
65878a
         set_free_free(unix_sockets);
65878a