teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From 85e9236488cfad07cc0aa4d23610bc25039dda27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 30 Jan 2014 21:40:27 -0500
Subject: [PATCH] tmpfiles: fix memory leak of exclude_prefixes

Missed in 5c795114.
---
 src/tmpfiles/tmpfiles.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 5e49cc8..fb88acd 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1332,12 +1332,12 @@ static int parse_argv(int argc, char *argv[]) {
                         break;
 
                 case ARG_PREFIX:
-                        if (strv_extend(&include_prefixes, optarg) < 0)
+                        if (strv_push(&include_prefixes, optarg) < 0)
                                 return log_oom();
                         break;
 
                 case ARG_EXCLUDE_PREFIX:
-                        if (strv_extend(&exclude_prefixes, optarg) < 0)
+                        if (strv_push(&exclude_prefixes, optarg) < 0)
                                 return log_oom();
                         break;
 
@@ -1498,7 +1498,8 @@ finish:
         hashmap_free(items);
         hashmap_free(globs);
 
-        strv_free(include_prefixes);
+        free(include_prefixes);
+        free(exclude_prefixes);
 
         set_free_free(unix_sockets);