dcavalca / rpms / systemd

Forked from rpms/systemd 4 months ago
Clone
594167
From b8ccf30c4654ed5697562842a8a608e627425370 Mon Sep 17 00:00:00 2001
594167
From: Yu Watanabe <watanabe.yu+github@gmail.com>
594167
Date: Mon, 9 May 2022 00:56:05 +0900
594167
Subject: [PATCH] core/unit: fix use-after-free
594167
594167
Fixes #23312.
594167
594167
(cherry picked from commit 734582830b58e000a26e18807ea277c18778573c)
594167
594167
Related: #2087652
594167
---
594167
 src/core/unit.c | 4 ++--
594167
 1 file changed, 2 insertions(+), 2 deletions(-)
594167
594167
diff --git a/src/core/unit.c b/src/core/unit.c
594167
index aac87dcc7a..0eade13ee9 100644
594167
--- a/src/core/unit.c
594167
+++ b/src/core/unit.c
594167
@@ -671,8 +671,8 @@ Unit* unit_free(Unit *u) {
594167
 
594167
         unit_dequeue_rewatch_pids(u);
594167
 
594167
-        sd_bus_slot_unref(u->match_bus_slot);
594167
-        sd_bus_track_unref(u->bus_track);
594167
+        u->match_bus_slot = sd_bus_slot_unref(u->match_bus_slot);
594167
+        u->bus_track = sd_bus_track_unref(u->bus_track);
594167
         u->deserialized_refs = strv_free(u->deserialized_refs);
594167
         u->pending_freezer_message = sd_bus_message_unref(u->pending_freezer_message);
594167