From 54f214dfaaf05bb1403344ce030dbc9f08414d19 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 23 Oct 2015 16:30:15 +0000 Subject: [PATCH] Remove some unnecessary checks before free(). --- usr.bin/tmux/cmd-new-session.c | 4 ++-- usr.bin/tmux/cmd-new-window.c | 4 ++-- usr.bin/tmux/cmd-split-window.c | 4 ++-- usr.bin/tmux/tty.c | 8 +++----- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index e7c0fc79162..45a0510c388 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.71 2015/09/10 08:58:14 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.72 2015/10/23 16:30:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -133,7 +133,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) strerror(errno)); return (CMD_RETURN_ERROR); } - } else if (cp != NULL) + } else free(cp); cwd = fd; } else if (c != NULL && c->session == NULL) diff --git a/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c index 154ef57d37c..1c7653ee63a 100644 --- a/usr.bin/tmux/cmd-new-window.c +++ b/usr.bin/tmux/cmd-new-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-window.c,v 1.46 2015/06/17 16:50:28 nicm Exp $ */ +/* $OpenBSD: cmd-new-window.c,v 1.47 2015/10/23 16:30:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -107,7 +107,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq) strerror(errno)); return (CMD_RETURN_ERROR); } - } else if (cp != NULL) + } else free(cp); cwd = fd; } else if (cmdq->client != NULL && cmdq->client->session == NULL) diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c index b774b753971..9bc8278cedf 100644 --- a/usr.bin/tmux/cmd-split-window.c +++ b/usr.bin/tmux/cmd-split-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-split-window.c,v 1.57 2015/04/26 20:25:20 nicm Exp $ */ +/* $OpenBSD: cmd-split-window.c,v 1.58 2015/10/23 16:30:15 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -101,7 +101,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) strerror(errno)); return (CMD_RETURN_ERROR); } - } else if (cp != NULL) + } else free(cp); cwd = fd; } else if (cmdq->client != NULL && cmdq->client->session == NULL) diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index db27a0447fd..23d62789b74 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.189 2015/10/23 15:52:54 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.190 2015/10/23 16:30:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -338,10 +338,8 @@ tty_free(struct tty *tty) tty_close(tty); free(tty->ccolour); - if (tty->path != NULL) - free(tty->path); - if (tty->termname != NULL) - free(tty->termname); + free(tty->path); + free(tty->termname); } void -- 2.20.1