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