mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
Shorten a long line, and don't leak buffer in paste_add if size is zero.
This commit is contained in:
parent
cea463a1b6
commit
01c6300247
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: paste.c,v 1.38 2016/10/12 09:07:58 nicm Exp $ */
|
||||
/* $OpenBSD: paste.c,v 1.39 2017/01/24 13:28:33 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -163,8 +163,10 @@ paste_add(char *data, size_t size)
|
||||
struct paste_buffer *pb, *pb1;
|
||||
u_int limit;
|
||||
|
||||
if (size == 0)
|
||||
if (size == 0) {
|
||||
free(data);
|
||||
return;
|
||||
}
|
||||
|
||||
limit = options_get_number(global_options, "buffer-limit");
|
||||
RB_FOREACH_REVERSE_SAFE(pb, paste_time_tree, &paste_by_time, pb1) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: window.c,v 1.181 2017/01/23 10:09:43 nicm Exp $ */
|
||||
/* $OpenBSD: window.c,v 1.182 2017/01/24 13:28:33 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -886,7 +886,8 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
|
||||
ws.ws_col = screen_size_x(&wp->base);
|
||||
ws.ws_row = screen_size_y(&wp->base);
|
||||
|
||||
switch (wp->pid = pty_fork(ptm_fd, &wp->fd, wp->tty, sizeof wp->tty, &ws)) {
|
||||
wp->pid = pty_fork(ptm_fd, &wp->fd, wp->tty, sizeof wp->tty, &ws);
|
||||
switch (wp->pid) {
|
||||
case -1:
|
||||
wp->fd = -1;
|
||||
xasprintf(cause, "%s: %s", cmd, strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user