summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2017-12-16 10:27:21 +0000
committeranton <anton@openbsd.org>2017-12-16 10:27:21 +0000
commitd99a06615257d2b0453541ec619344fb2a5adaf0 (patch)
treed61fd31933302018743c258eaadb675c8bdbe7b6
parentacrtc(4), sxirsb(4) (diff)
downloadwireguard-openbsd-d99a06615257d2b0453541ec619344fb2a5adaf0.tar.xz
wireguard-openbsd-d99a06615257d2b0453541ec619344fb2a5adaf0.zip
Passing NULL to free() is fine; from Michael W. Bombardieri.
-rw-r--r--bin/csh/csh.c8
-rw-r--r--bin/csh/dol.c5
-rw-r--r--bin/csh/error.c8
-rw-r--r--bin/csh/func.c8
4 files changed, 11 insertions, 18 deletions
diff --git a/bin/csh/csh.c b/bin/csh/csh.c
index d737c31ab30..4971cf04303 100644
--- a/bin/csh/csh.c
+++ b/bin/csh/csh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: csh.c,v 1.42 2017/12/12 00:18:58 tb Exp $ */
+/* $OpenBSD: csh.c,v 1.43 2017/12/16 10:27:21 anton Exp $ */
/* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */
/*-
@@ -1013,10 +1013,8 @@ process(bool catch)
printprompt();
(void) fflush(cshout);
}
- if (seterr) {
- free(seterr);
- seterr = NULL;
- }
+ free(seterr);
+ seterr = NULL;
/*
* Echo not only on VERBOSE, but also with history expansion. If there
diff --git a/bin/csh/dol.c b/bin/csh/dol.c
index 5eb3ee1f95e..95b24558643 100644
--- a/bin/csh/dol.c
+++ b/bin/csh/dol.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dol.c,v 1.20 2015/12/26 13:48:38 mestre Exp $ */
+/* $OpenBSD: dol.c,v 1.21 2017/12/16 10:27:21 anton Exp $ */
/* $NetBSD: dol.c,v 1.8 1995/09/27 00:38:38 jtc Exp $ */
/*-
@@ -408,8 +408,7 @@ Dgetdol(void)
if (dimen || bitset)
stderror(ERR_SYNTAX);
if (backpid != 0) {
- if (dolbang)
- free(dolbang);
+ free(dolbang);
setDolp(dolbang = putn(backpid));
}
goto eatbrac;
diff --git a/bin/csh/error.c b/bin/csh/error.c
index 88bed5b154b..9f41b741da2 100644
--- a/bin/csh/error.c
+++ b/bin/csh/error.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: error.c,v 1.12 2015/12/26 13:48:38 mestre Exp $ */
+/* $OpenBSD: error.c,v 1.13 2017/12/16 10:27:21 anton Exp $ */
/* $NetBSD: err.c,v 1.6 1995/03/21 09:02:47 cgd Exp $ */
/*-
@@ -346,10 +346,8 @@ stderror(int id, ...)
}
}
- if (seterr) {
- free(seterr);
- seterr = NULL;
- }
+ free(seterr);
+ seterr = NULL;
if ((v = pargv) != NULL)
pargv = 0, blkfree(v);
diff --git a/bin/csh/func.c b/bin/csh/func.c
index 0cdcf62251b..1a7476343c4 100644
--- a/bin/csh/func.c
+++ b/bin/csh/func.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: func.c,v 1.35 2017/08/30 06:42:21 anton Exp $ */
+/* $OpenBSD: func.c,v 1.36 2017/12/16 10:27:21 anton Exp $ */
/* $NetBSD: func.c,v 1.11 1996/02/09 02:28:29 christos Exp $ */
/*-
@@ -824,8 +824,7 @@ wfree(void)
if (wp->w_fe0)
blkfree(wp->w_fe0);
- if (wp->w_fename)
- free(wp->w_fename);
+ free(wp->w_fename);
free(wp);
}
}
@@ -929,8 +928,7 @@ dounsetenv(Char **v, struct command *t)
int i, maxi;
static Char *name = NULL;
- if (name)
- free(name);
+ free(name);
/*
* Find the longest environment variable
*/