From 8b079ed1986e40be52653bfa72f81bfe58f94811 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 8 May 2025 16:37:06 +0200 Subject: [PATCH] include: regionstr.h: protect RegionUninit() from free()ing on .data There might be a chance that RegionUninit() is trying to free() some struct that's actually coming from .data segment. Signed-off-by: Enrico Weigelt, metux IT consult --- include/regionstr.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/regionstr.h b/include/regionstr.h index 103235859..a42290124 100644 --- a/include/regionstr.h +++ b/include/regionstr.h @@ -163,7 +163,8 @@ static inline void RegionUninit(RegionPtr _pReg) { if ((_pReg)->data && (_pReg)->data->size) { - free((_pReg)->data); + if ((_pReg)->data != &RegionEmptyData) + free((_pReg)->data); (_pReg)->data = NULL; } }