richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
594167
From e9acfceb104c8f9ccec8b468b5d111844285f43a Mon Sep 17 00:00:00 2001
594167
From: Yu Watanabe <watanabe.yu+github@gmail.com>
594167
Date: Tue, 10 May 2022 14:10:17 +0900
594167
Subject: [PATCH] core/timer: fix potential use-after-free
594167
594167
(cherry picked from commit 756491af392a99c4286d876b0041535e50df80ad)
594167
594167
Related: #2087652
594167
---
594167
 src/core/timer.c | 2 +-
594167
 1 file changed, 1 insertion(+), 1 deletion(-)
594167
594167
diff --git a/src/core/timer.c b/src/core/timer.c
594167
index 0dc49dd46b..b439802bc2 100644
594167
--- a/src/core/timer.c
594167
+++ b/src/core/timer.c
594167
@@ -68,7 +68,7 @@ static void timer_done(Unit *u) {
594167
         t->monotonic_event_source = sd_event_source_disable_unref(t->monotonic_event_source);
594167
         t->realtime_event_source = sd_event_source_disable_unref(t->realtime_event_source);
594167
 
594167
-        free(t->stamp_path);
594167
+        t->stamp_path = mfree(t->stamp_path);
594167
 }
594167
 
594167
 static int timer_verify(Timer *t) {