evbuffer_new and bufferevent_new can both fail (when malloc fails) and

return NULL. GitHub issue 1547.
This commit is contained in:
nicm
2018-11-19 13:35:40 +00:00
parent f103927a52
commit 749f67b7d8
8 changed files with 24 additions and 0 deletions

4
tty.c
View File

@ -258,9 +258,13 @@ tty_open(struct tty *tty, char **cause)
event_set(&tty->event_in, tty->fd, EV_PERSIST|EV_READ,
tty_read_callback, tty);
tty->in = evbuffer_new();
if (tty->in == NULL)
fatal("out of memory");
event_set(&tty->event_out, tty->fd, EV_WRITE, tty_write_callback, tty);
tty->out = evbuffer_new();
if (tty->out == NULL)
fatal("out of memory");
evtimer_set(&tty->timer, tty_timer_callback, tty);