aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cli.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cli.c b/src/cli.c
index 3fef348..05437a0 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -37,16 +37,21 @@ cli_read_input(void)
{
char *txt = readline("");
- if ((!txt) || (*txt == '\0'))
+ if ((!txt) || (txt[0] == '\0')) {
return DISP_QUIT;
- if (*txt == 'q')
+ }
+ else if (txt[0] == 'q') {
+ free(txt);
return DISP_QUIT;
+ }
#ifndef NDEBUG
if ((*txt == 'r') || (*txt == 'g'))
return DISP_RELOAD;
#endif
- return atoi(txt);
+ int res = atoi(txt);
+ free(txt);
+ return res;
}
void