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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-08 16:37:06 +02:00
parent 2b9ccde53a
commit 8b079ed198

View File

@ -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;
}
}