summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authormmcc <mmcc@openbsd.org>2015-11-27 01:57:59 +0000
committermmcc <mmcc@openbsd.org>2015-11-27 01:57:59 +0000
commit18e2b3b18b8577a7221d53d6a20e75794f8d41d4 (patch)
treefcd1b37eb3509e9508f6015495fcfb0118747ac0 /lib/libutil
parentsync (diff)
downloadwireguard-openbsd-18e2b3b18b8577a7221d53d6a20e75794f8d41d4.tar.xz
wireguard-openbsd-18e2b3b18b8577a7221d53d6a20e75794f8d41d4.zip
Remove three NULL-checks before free(). ok millert@
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/imsg.c5
-rw-r--r--lib/libutil/login_fbtab.c5
-rw-r--r--lib/libutil/pidfile.c8
3 files changed, 7 insertions, 11 deletions
diff --git a/lib/libutil/imsg.c b/lib/libutil/imsg.c
index 5b1a7c13cf4..8a50aa5142b 100644
--- a/lib/libutil/imsg.c
+++ b/lib/libutil/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.10 2015/07/19 07:18:59 nicm Exp $ */
+/* $OpenBSD: imsg.c,v 1.11 2015/11/27 01:57:59 mmcc Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -118,8 +118,7 @@ again:
}
fail:
- if (ifd)
- free(ifd);
+ free(ifd);
return (n);
}
diff --git a/lib/libutil/login_fbtab.c b/lib/libutil/login_fbtab.c
index ad40b06f59d..5eacf4f65ff 100644
--- a/lib/libutil/login_fbtab.c
+++ b/lib/libutil/login_fbtab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login_fbtab.c,v 1.15 2015/08/20 21:34:04 deraadt Exp $ */
+/* $OpenBSD: login_fbtab.c,v 1.16 2015/11/27 01:57:59 mmcc Exp $ */
/************************************************************************
* Copyright 1995 by Wietse Venema. All rights reserved. Some individual
@@ -124,8 +124,7 @@ login_fbtab(const char *tty, uid_t uid, gid_t gid)
login_protect(cp, prot, uid, gid);
}
}
- if (tbuf != NULL)
- free(tbuf);
+ free(tbuf);
fclose(fp);
}
diff --git a/lib/libutil/pidfile.c b/lib/libutil/pidfile.c
index 4c365d023ea..af049d17ecb 100644
--- a/lib/libutil/pidfile.c
+++ b/lib/libutil/pidfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pidfile.c,v 1.11 2015/06/03 02:24:36 millert Exp $ */
+/* $OpenBSD: pidfile.c,v 1.12 2015/11/27 01:57:59 mmcc Exp $ */
/* $NetBSD: pidfile.c,v 1.4 2001/02/19 22:43:42 cgd Exp $ */
/*-
@@ -55,10 +55,8 @@ pidfile(const char *basename)
if (basename == NULL)
basename = __progname;
- if (pidfile_path != NULL) {
- free(pidfile_path);
- pidfile_path = NULL;
- }
+ free(pidfile_path);
+ pidfile_path = NULL;
/* _PATH_VARRUN includes trailing / */
if (asprintf(&pidfile_path, "%s%s.pid", _PATH_VARRUN, basename) == -1)