This website works better with JavaScript.
Home
Explore
Help
Sign In
Immanuel
/
nnn
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
Fix segfault in readln()
This could be reproduced simply by doing: [TAB] and backspacing a few times.
master
sin
10 years ago
parent
330adc995f
commit
cfd530b167
1 changed files
with
7 additions
and
2 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+7
-2
noice.c
+ 7
- 2
noice.c
View File
@@ -287,8 +287,13 @@ readln(void)
if (c == KEY_BACKSPACE) {
getyx(stdscr, y, x);
if (x >= x0) {
ln = realloc(ln, (i - 1) * sizeof(*ln));
i--;
if (i > 0) {
ln = realloc(ln, (i - 1) * sizeof(*ln));
i--;
} else {
free(ln);
ln = NULL;
}
move(y, x);
printw("%c", ' ');
move(y, x);
Write
Preview
Loading…
Cancel
Save