From 3cd3b20f58e9d2c6463d503be09e5d4cfaadee6c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 12 Oct 2025 14:05:22 -0400 Subject: Code cleanup and fixing minor issues --- src/stdlib/stdlib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/stdlib/stdlib.c') diff --git a/src/stdlib/stdlib.c b/src/stdlib/stdlib.c index 0756eab3..5204194b 100644 --- a/src/stdlib/stdlib.c +++ b/src/stdlib/stdlib.c @@ -59,7 +59,8 @@ static _Noreturn void signal_handler(int sig, siginfo_t *info, void *userdata) { public void tomo_init(void) { GC_INIT(); - USE_COLOR = getenv("COLOR") ? strcmp(getenv("COLOR"), "1") == 0 : isatty(STDOUT_FILENO); + const char *color_env = getenv("COLOR"); + USE_COLOR = color_env ? strcmp(color_env, "1") == 0 : isatty(STDOUT_FILENO); if (getenv("NO_COLOR") && getenv("NO_COLOR")[0] != '\0') USE_COLOR = false; setlocale(LC_ALL, ""); @@ -194,6 +195,7 @@ OptionalText_t ask(Text_t prompt, bool bold, bool force_tty) { cleanup: if (out && out != stdout) fclose(out); if (in && in != stdin) fclose(in); + if (line != NULL) free(line); return ret; } -- cgit v1.2.3