shithub: choc

Download patch

ref: db16605af019515128abbc2874caaaad7a55c356
parent: b21e768d00205ee79c7f0ab6ee7549437b06afd1
author: Turo Lamminen <[email protected]>
date: Wed Apr 27 14:16:34 EDT 2022

textscreen: Fix use after free

--- a/textscreen/txt_window.c
+++ b/textscreen/txt_window.c
@@ -555,12 +555,12 @@
 #endif
 
     retval = system(cmd);
-    free(cmd);
     if (retval != 0)
     {
         fprintf(stderr, "TXT_OpenURL: error executing '%s'; return code %d\n",
             cmd, retval);
     }
+    free(cmd);
 }
 
 #endif /* #ifndef _WIN32 */