Otherwise the next historyAdd will access freed memory, and crash.
free(history[j]);
free(history);
history = NULL;
+ history_len = 0;
}
}
{
COORD pos = { (SHORT)current->x, (SHORT)current->y };
DWORD n;
-
+
WriteConsoleOutputCharacter(current->outh, buf, len, pos, &n);
current->x += len;
return 0;
char buf[LINENOISE_MAX_LINE];
if (enableRawMode(¤t) == -1) {
- printf("%s", prompt);
+ printf("%s", prompt);
fflush(stdout);
if (fgets(buf, sizeof(buf), stdin) == NULL) {
- return NULL;
+ return NULL;
}
count = strlen(buf);
if (count && buf[count-1] == '\n') {