Kaynağa Gözat

Fix segfault in readln()

This could be reproduced simply by doing: [TAB] and backspacing
a few times.
master
sin 11 yıl önce
ebeveyn
işleme
cfd530b167
1 değiştirilmiş dosya ile 7 ekleme ve 2 silme
  1. +7
    -2
      noice.c

+ 7
- 2
noice.c Dosyayı Görüntüle

@@ -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);


Yükleniyor…
İptal
Kaydet