dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
Blob Blame History Raw
From 18b0bc42dc097af6147324deef100c41dedfa755 Mon Sep 17 00:00:00 2001
From: Daan De Meyer <daan.j.demeyer@gmail.com>
Date: Mon, 9 May 2022 09:50:32 +0200
Subject: [PATCH] shared: Fix memory leak in bus_append_execute_property()

Fixes #23317

(cherry picked from commit 2aaf6d407e8541985a15b7106abf6fbdfed0766a)
Related: #2087652
---
 src/shared/bus-unit-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index dcce530c99..ef134bcee4 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -1952,7 +1952,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
                         path_simplify(source);
 
                         if (isempty(destination)) {
-                                r = strv_extend(&sources, TAKE_PTR(source));
+                                r = strv_consume(&sources, TAKE_PTR(source));
                                 if (r < 0)
                                         return bus_log_create_error(r);
                         } else {