mirror of
https://github.com/janet-lang/janet
synced 2025-11-27 12:35:13 +00:00
Fix some very mild memory leaks in line.c and the do_bytes function (not
deiniting the parser).
This commit is contained in:
@@ -265,6 +265,8 @@ static void addhistory() {
|
||||
if (len < DST_HISTORY_MAX) {
|
||||
dst_v_push(history, newline);
|
||||
len++;
|
||||
} else {
|
||||
free(history[DST_HISTORY_MAX - 1]);
|
||||
}
|
||||
for (i = len - 1; i > 0; i--) {
|
||||
history[i] = history[i - 1];
|
||||
@@ -275,6 +277,7 @@ static void addhistory() {
|
||||
static void replacehistory() {
|
||||
char *newline = sdup(buf);
|
||||
if (!newline) return;
|
||||
free(history[0]);
|
||||
history[0] = newline;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user