mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
evbuffer_new and bufferevent_new can both fail (when malloc fails) and
return NULL. GitHub issue 1547.
This commit is contained in:
parent
e22141d5ca
commit
b32e1d34e1
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cmd-pipe-pane.c,v 1.47 2018/01/16 09:00:38 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-pipe-pane.c,v 1.48 2018/11/19 13:35:40 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -166,6 +166,8 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmd_pipe_pane_write_callback,
|
||||
cmd_pipe_pane_error_callback,
|
||||
wp);
|
||||
if (wp->pipe_event == NULL)
|
||||
fatalx("out of memory");
|
||||
if (out)
|
||||
bufferevent_enable(wp->pipe_event, EV_WRITE);
|
||||
if (in)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: control-notify.c,v 1.21 2017/05/04 07:16:43 nicm Exp $ */
|
||||
/* $OpenBSD: control-notify.c,v 1.22 2018/11/19 13:35:40 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -47,6 +47,8 @@ control_notify_input(struct client *c, struct window_pane *wp,
|
||||
*/
|
||||
if (winlink_find_by_window(&c->session->windows, wp->window) != NULL) {
|
||||
message = evbuffer_new();
|
||||
if (message == NULL)
|
||||
fatalx("out of memory");
|
||||
evbuffer_add_printf(message, "%%output %%%u ", wp->id);
|
||||
for (i = 0; i < len; i++) {
|
||||
if (buf[i] < ' ' || buf[i] == '\\')
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: format.c,v 1.164 2018/10/18 08:38:01 nicm Exp $ */
|
||||
/* $OpenBSD: format.c,v 1.165 2018/11/19 13:35:41 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -573,6 +573,8 @@ format_cb_pane_tabs(struct format_tree *ft, struct format_entry *fe)
|
||||
return;
|
||||
|
||||
buffer = evbuffer_new();
|
||||
if (buffer == NULL)
|
||||
fatalx("out of memory");
|
||||
for (i = 0; i < wp->base.grid->sx; i++) {
|
||||
if (!bit_test(wp->base.tabs, i))
|
||||
continue;
|
||||
@ -603,6 +605,8 @@ format_cb_session_group_list(struct format_tree *ft, struct format_entry *fe)
|
||||
return;
|
||||
|
||||
buffer = evbuffer_new();
|
||||
if (buffer == NULL)
|
||||
fatalx("out of memory");
|
||||
TAILQ_FOREACH(loop, &sg->sessions, gentry) {
|
||||
if (EVBUFFER_LENGTH(buffer) > 0)
|
||||
evbuffer_add(buffer, ",", 1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: input.c,v 1.138 2018/10/18 08:04:14 nicm Exp $ */
|
||||
/* $OpenBSD: input.c,v 1.139 2018/11/19 13:35:41 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -767,6 +767,8 @@ input_init(struct window_pane *wp)
|
||||
ictx->input_buf = xmalloc(INPUT_BUF_START);
|
||||
|
||||
ictx->since_ground = evbuffer_new();
|
||||
if (ictx->since_ground == NULL)
|
||||
fatalx("out of memory");
|
||||
|
||||
evtimer_set(&ictx->timer, input_timer_callback, ictx);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: job.c,v 1.53 2018/10/28 16:10:02 nicm Exp $ */
|
||||
/* $OpenBSD: job.c,v 1.54 2018/11/19 13:35:41 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -155,6 +155,8 @@ job_run(const char *cmd, struct session *s, const char *cwd,
|
||||
|
||||
job->event = bufferevent_new(job->fd, job_read_callback,
|
||||
job_write_callback, job_error_callback, job);
|
||||
if (job->event == NULL)
|
||||
fatalx("out of memory");
|
||||
bufferevent_enable(job->event, EV_READ|EV_WRITE);
|
||||
|
||||
log_debug("run job %p: %s, pid %ld", job, job->cmd, (long) job->pid);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: server-client.c,v 1.262 2018/11/07 08:06:28 nicm Exp $ */
|
||||
/* $OpenBSD: server-client.c,v 1.263 2018/11/19 13:35:41 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -186,8 +186,14 @@ server_client_create(int fd)
|
||||
TAILQ_INIT(&c->queue);
|
||||
|
||||
c->stdin_data = evbuffer_new();
|
||||
if (c->stdin_data == NULL)
|
||||
fatalx("out of memory");
|
||||
c->stdout_data = evbuffer_new();
|
||||
if (c->stdout_data == NULL)
|
||||
fatalx("out of memory");
|
||||
c->stderr_data = evbuffer_new();
|
||||
if (c->stderr_data == NULL)
|
||||
fatalx("out of memory");
|
||||
|
||||
c->tty.fd = -1;
|
||||
c->title = NULL;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tty.c,v 1.310 2018/10/25 15:13:38 nicm Exp $ */
|
||||
/* $OpenBSD: tty.c,v 1.311 2018/11/19 13:35:41 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -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);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: window.c,v 1.213 2018/10/18 08:38:01 nicm Exp $ */
|
||||
/* $OpenBSD: window.c,v 1.214 2018/11/19 13:35:41 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user