Check for NULL returns from bufferevent_new.

This commit is contained in:
nicm
2022-08-24 07:22:30 +00:00
parent 416c27c995
commit e867528209
3 changed files with 10 additions and 0 deletions

4
file.c
View File

@ -588,6 +588,8 @@ file_write_open(struct client_files *files, struct tmuxpeer *peer,
cf->event = bufferevent_new(cf->fd, NULL, file_write_callback,
file_write_error_callback, cf);
if (cf->event == NULL)
fatalx("out of memory");
bufferevent_enable(cf->event, EV_WRITE);
goto reply;
@ -747,6 +749,8 @@ file_read_open(struct client_files *files, struct tmuxpeer *peer,
cf->event = bufferevent_new(cf->fd, file_read_callback, NULL,
file_read_error_callback, cf);
if (cf->event == NULL)
fatalx("out of memory");
bufferevent_enable(cf->event, EV_READ);
return;