thermald/SOURCES/0002-adaptive-Fix-use-after-free.patch
2021-09-10 05:11:15 +00:00

32 lines
880 B
Diff

From a10d4ddeb8b55e238289d63a2623b8936eb6bda4 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Thu, 10 Dec 2020 11:36:43 +0100
Subject: [PATCH 2/3] adaptive: Fix use-after-free
The debug logging would access a recently free'ed variable. Fix this by
changing the order.
---
src/thd_engine_adaptive.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/thd_engine_adaptive.cpp b/src/thd_engine_adaptive.cpp
index 4824a9d..b68cc40 100644
--- a/src/thd_engine_adaptive.cpp
+++ b/src/thd_engine_adaptive.cpp
@@ -692,10 +692,11 @@ int cthd_engine_adaptive::parse_gddv_key(char *buf, int size, int *end_offset) {
str = strtok(key, "/");
if (!str) {
+ thd_log_debug("Ignoring key %s\n", key);
+
delete[] (key);
delete[] (val);
- thd_log_debug("Ignoring key %s\n", key);
/* Ignore */
return THD_SUCCESS;
}
--
2.26.2