mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +00:00
realloc() behaves like free() if size is 0
This commit is contained in:
parent
644dd348d6
commit
8d018e620f
1 changed files with 2 additions and 2 deletions
4
noice.c
4
noice.c
|
@ -366,9 +366,9 @@ readln(void)
|
|||
if (c == KEY_BACKSPACE) {
|
||||
getyx(stdscr, y, x);
|
||||
if (x >= x0) {
|
||||
if (i > 0) {
|
||||
ln = xrealloc(ln, (i - 1) * sizeof(*ln));
|
||||
i--;
|
||||
if (i > 0) {
|
||||
ln = xrealloc(ln, i * sizeof(*ln));
|
||||
} else {
|
||||
free(ln);
|
||||
ln = NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue