From b1cbde1082b35c140c9a827bfbfe106fc9de67ac Mon Sep 17 00:00:00 2001 From: anonymouspage <123-anonymouspage@users.noreply.gitlab.synchro.net> Date: Thu, 20 Oct 2022 17:30:17 -0700 Subject: [PATCH] ciolib_puttext: free() is not reachable As far as I can tell, this free() in ciolib_puttext() is not reachable given the current logic in the function; and, the value of buf is not modified by any called functions. Also, this function is invoked with stack allocated buffers, so it isn't safe to assume a free() is valid in this context. Better to let the owner of the buffer manage the lifecycle. --- src/conio/ciolib.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/conio/ciolib.c b/src/conio/ciolib.c index a54baa628f..33c0bcb9e6 100644 --- a/src/conio/ciolib.c +++ b/src/conio/ciolib.c @@ -1170,13 +1170,10 @@ CIOLIBEXPORT void ciolib_normvideo(void) */ CIOLIBEXPORT int ciolib_puttext(int a,int b,int c,int d,void *e) { - char *buf=e; int ret; CIOLIB_INIT(); ret = cio_api.puttext(a,b,c,d,(void *)buf); - if (buf != e) - free(buf); return ret; } -- GitLab