From a024fb90751ed21833816ca783ff1076f72216cd Mon Sep 17 00:00:00 2001 From: Jerry James Date: Thu, 29 Jun 2023 16:16:46 -0600 Subject: [PATCH] Avoid possible use-after-free in Togl --- Togl/src/Togl/togl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Togl/src/Togl/togl.c b/Togl/src/Togl/togl.c index 0b71b99..0fbcd15 100644 --- a/Togl/src/Togl/togl.c +++ b/Togl/src/Togl/togl.c @@ -2780,7 +2780,6 @@ noFaultXAllocColor(Display *dpy, Colormap cmap, int cmapSize, subColor.red = ctable[bestmatch].red; subColor.green = ctable[bestmatch].green; subColor.blue = ctable[bestmatch].blue; - free(ctable); /* Try to allocate the closest match color. This should only fail if the * cell is read/write. Otherwise, we're incrementing the cell's reference * count. */ @@ -2792,6 +2791,7 @@ noFaultXAllocColor(Display *dpy, Colormap cmap, int cmapSize, subColor.blue = ctable[bestmatch].blue; subColor.flags = DoRed | DoGreen | DoBlue; } + free(ctable); *color = subColor; }