From 749f67b7d801eed03345fef9c04206fbd079c3cb Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 19 Nov 2018 13:35:40 +0000 Subject: evbuffer_new and bufferevent_new can both fail (when malloc fails) and return NULL. GitHub issue 1547. --- window.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'window.c') diff --git a/window.c b/window.c index 6e76b480..530d9574 100644 --- a/window.c +++ b/window.c @@ -997,6 +997,8 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv, wp->event = bufferevent_new(wp->fd, window_pane_read_callback, NULL, window_pane_error_callback, wp); + if (wp->event == NULL) + fatalx("out of memory"); bufferevent_setwatermark(wp->event, EV_READ, 0, READ_SIZE); bufferevent_enable(wp->event, EV_READ|EV_WRITE); -- cgit