noice

small file browser
git clone git://git.2f30.org/noice.git
Log | Files | Refs | README | LICENSE

commit 8d018e620f159d63c1617a87844d11e51f7a3a23
parent 644dd348d6e0a85c9e8ce472e631a2713e07efcc
Author: sin <sin@2f30.org>
Date:   Wed Oct 22 17:57:59 +0100

realloc() behaves like free() if size is 0

Diffstat:
noice.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/noice.c b/noice.c @@ -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;