From b898fd5b317611ee8c41773ef8c4fb65eab63e2f Mon Sep 17 00:00:00 2001 From: Sara Date: Fri, 5 May 2023 22:17:28 +0200 Subject: [PATCH] added return in guard clause for empty drawcmd buffer draw(cmd) had a bug causing the first drawcmd in every frame to be added twice, for text this would cause a double free --- src/corelib/render.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/render.c b/src/corelib/render.c index 543e7d1..e39b58b 100644 --- a/src/corelib/render.c +++ b/src/corelib/render.c @@ -344,6 +344,7 @@ void insert_drawcmd_at(size_t index, const drawcmd_t* cmd) { void draw(const drawcmd_t* cmd) { if(g_drawdata_endptr == g_drawdata) { insert_drawcmd_at(0, cmd); + return; } long top = (size_t)(g_drawdata_endptr - g_drawdata), bot = 0,