summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormestre <mestre@openbsd.org>2016-03-28 19:09:08 +0000
committermestre <mestre@openbsd.org>2016-03-28 19:09:08 +0000
commit8be1120a5b920c8df75d21b329afd16f3ef0e998 (patch)
tree6ffd7b9c3e7840535fb534bf5260a837dbd707ab
parentMatch based on _HID instead of the driver name. (diff)
downloadwireguard-openbsd-8be1120a5b920c8df75d21b329afd16f3ef0e998.tar.xz
wireguard-openbsd-8be1120a5b920c8df75d21b329afd16f3ef0e998.zip
Remove handrolled #define FREE and use free(3) directly without wrapping
if (ptr!=NULL) around them since they are not needed. OK millert@ and jung@
-rw-r--r--usr.sbin/user/defs.h4
-rw-r--r--usr.sbin/user/user.c20
2 files changed, 7 insertions, 17 deletions
diff --git a/usr.sbin/user/defs.h b/usr.sbin/user/defs.h
index 18bc9d2f3c9..029e49ac222 100644
--- a/usr.sbin/user/defs.h
+++ b/usr.sbin/user/defs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: defs.h,v 1.6 2015/08/20 22:39:29 deraadt Exp $ */
+/* $OpenBSD: defs.h,v 1.7 2016/03/28 19:09:08 mestre Exp $ */
/* $NetBSD: defs.h,v 1.5 1999/12/24 09:08:49 agc Exp $ */
/*
@@ -54,8 +54,6 @@
#define NEW(type, ptr, action) NEWARRAY(type, ptr, 1, action)
-#define FREE(ptr) (void) free(ptr)
-
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c
index b27f0e2c231..7c5b9bb511d 100644
--- a/usr.sbin/user/user.c
+++ b/usr.sbin/user/user.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: user.c,v 1.104 2015/11/15 23:13:20 deraadt Exp $ */
+/* $OpenBSD: user.c,v 1.105 2016/03/28 19:09:08 mestre Exp $ */
/* $NetBSD: user.c,v 1.69 2003/04/14 17:40:07 agc Exp $ */
/*
@@ -192,9 +192,7 @@ static int verbose;
static void
memsave(char **cpp, const char *s, size_t n)
{
- if (*cpp != NULL) {
- FREE(*cpp);
- }
+ free(*cpp);
NEWARRAY(char, *cpp, n + 1, exit(1));
(void) memcpy(*cpp, s, n);
(*cpp)[n] = '\0';
@@ -799,9 +797,7 @@ read_defaults(user_t *up)
for (cp = s + 8 ; isspace((unsigned char)*cp); cp++) {
}
if (strcmp(cp, UNSET_INACTIVE) == 0) {
- if (up->u_inactive) {
- FREE(up->u_inactive);
- }
+ free(up->u_inactive);
up->u_inactive = NULL;
} else {
memsave(&up->u_inactive, cp, strlen(cp));
@@ -820,9 +816,7 @@ read_defaults(user_t *up)
for (cp = s + 6 ; isspace((unsigned char)*cp); cp++) {
}
if (strcmp(cp, UNSET_EXPIRY) == 0) {
- if (up->u_expire) {
- FREE(up->u_expire);
- }
+ free(up->u_expire);
up->u_expire = NULL;
} else {
memsave(&up->u_expire, cp, strlen(cp));
@@ -1679,10 +1673,8 @@ moduser(char *login_name, char *newlogin, user_t *up)
}
}
(void) close(ptmpfd);
- if (pw_tmp)
- FREE(pw_tmp);
- if (shell_tmp)
- FREE(shell_tmp);
+ free(pw_tmp);
+ free(shell_tmp);
if (up != NULL && strcmp(login_name, newlogin) == 0)
rval = pw_mkdb(login_name, 0);
else