diff --git a/src/msh.c b/src/msh.c index 2138962..062da60 100644 --- a/src/msh.c +++ b/src/msh.c @@ -457,6 +457,12 @@ int main(int argc, char** argv) { fflush(stdout); } + // oldline is only valid while reading + if (oldline != NULL) { + free(oldline); + oldline = NULL; + } + putc('\n', stdout); tcsetattr(fileno(stdin), 0, &orig_term);