summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2022-08-24 07:22:31 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2022-08-24 07:22:31 +0000
commitd5eef0117180cf75a4984bc54417c87533a6f15a (patch)
tree24f782d83c55b763600ac84c7808d70bf3cdb757 /usr.bin
parentcde1ef766beed750c2be4f30c8dfb49b2304b39f (diff)
Check for NULL returns from bufferevent_new.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/control.c6
-rw-r--r--usr.bin/tmux/file.c6
-rw-r--r--usr.bin/tmux/window.c4
3 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/tmux/control.c b/usr.bin/tmux/control.c
index d96db22d379..ef495b48f44 100644
--- a/usr.bin/tmux/control.c
+++ b/usr.bin/tmux/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.48 2022/07/06 08:31:59 nicm Exp $ */
+/* $OpenBSD: control.c,v 1.49 2022/08/24 07:22:30 nicm Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -776,12 +776,16 @@ control_start(struct client *c)
cs->read_event = bufferevent_new(c->fd, control_read_callback,
control_write_callback, control_error_callback, c);
+ if (cs->read_event == NULL)
+ fatalx("out of memory");
if (c->flags & CLIENT_CONTROLCONTROL)
cs->write_event = cs->read_event;
else {
cs->write_event = bufferevent_new(c->out_fd, NULL,
control_write_callback, control_error_callback, c);
+ if (cs->write_event == NULL)
+ fatalx("out of memory");
}
bufferevent_setwatermark(cs->write_event, EV_WRITE, CONTROL_BUFFER_LOW,
0);
diff --git a/usr.bin/tmux/file.c b/usr.bin/tmux/file.c
index acf08a8f4cc..336f004e1b5 100644
--- a/usr.bin/tmux/file.c
+++ b/usr.bin/tmux/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.12 2021/08/22 13:48:29 nicm Exp $ */
+/* $OpenBSD: file.c,v 1.13 2022/08/24 07:22:30 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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;
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 44c5b886953..c1edcdd22e0 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.281 2022/06/17 07:28:05 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.282 2022/08/24 07:22:30 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1033,6 +1033,8 @@ window_pane_set_event(struct window_pane *wp)
wp->event = bufferevent_new(wp->fd, window_pane_read_callback,
NULL, window_pane_error_callback, wp);
+ if (wp->event == NULL)
+ fatalx("out of memory");
wp->ictx = input_init(wp, wp->event, &wp->palette);
bufferevent_enable(wp->event, EV_READ|EV_WRITE);