diff options
| author | 2014-10-22 17:57:59 +0100 | |
|---|---|---|
| committer | 2014-10-22 17:57:59 +0100 | |
| commit | 8d018e620f159d63c1617a87844d11e51f7a3a23 (patch) | |
| tree | ddc46e6ef7341c89a5011498f88df7e9d05606df | |
| parent | 644dd348d6e0a85c9e8ce472e631a2713e07efcc (diff) | |
| download | nnn-8d018e620f159d63c1617a87844d11e51f7a3a23.tar.gz | |
realloc() behaves like free() if size is 0
| -rw-r--r-- | noice.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -366,9 +366,9 @@ readln(void) if (c == KEY_BACKSPACE) { getyx(stdscr, y, x); if (x >= x0) { + i--; if (i > 0) { - ln = xrealloc(ln, (i - 1) * sizeof(*ln)); - i--; + ln = xrealloc(ln, i * sizeof(*ln)); } else { free(ln); ln = NULL; |