From a269b89168b76fc86ac34d5e4e1fe83873510a1b Mon Sep 17 00:00:00 2001 From: nillerusr Date: Thu, 22 Sep 2022 22:37:30 +0300 Subject: [PATCH] game(client): fix crash on linux/window in touch, fix memory leak in touch --- game/client/touch.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/game/client/touch.cpp b/game/client/touch.cpp index cd6ed2c8..bdaaa1f5 100644 --- a/game/client/touch.cpp +++ b/game/client/touch.cpp @@ -505,8 +505,11 @@ void CTouchControls::CreateAtlasTexture() rectCount++; } - if( !textureList.Count() ) + if( !textureList.Count() || rectCount == 0 ) + { + free(rects); return; + } int atlasHeight = nextPowerOfTwo(sqrt((double)atlasSize)); int sizeInBytes = atlasHeight*atlasHeight*4;