Remove some unnecessary checks before free().
authornicm <nicm@openbsd.org>
Fri, 23 Oct 2015 16:30:15 +0000 (16:30 +0000)
committernicm <nicm@openbsd.org>
Fri, 23 Oct 2015 16:30:15 +0000 (16:30 +0000)
usr.bin/tmux/cmd-new-session.c
usr.bin/tmux/cmd-new-window.c
usr.bin/tmux/cmd-split-window.c
usr.bin/tmux/tty.c

index e7c0fc7..45a0510 100644 (file)
@@ -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 <nicm@users.sourceforge.net>
@@ -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)
index 154ef57..1c7653e 100644 (file)
@@ -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 <nicm@users.sourceforge.net>
@@ -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)
index b774b75..9bc8278 100644 (file)
@@ -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 <nicm@users.sourceforge.net>
@@ -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)
index db27a04..23d6278 100644 (file)
@@ -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 <nicm@users.sourceforge.net>
@@ -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