diff options
author | mmcc <mmcc@cvs.openbsd.org> | 2015-12-05 21:15:02 +0000 |
---|---|---|
committer | mmcc <mmcc@cvs.openbsd.org> | 2015-12-05 21:15:02 +0000 |
commit | f910f7f2b54456647cc0d871220a479790b79089 (patch) | |
tree | a55aa34b239863589fd5b3c06baf3a0a0662ebac /usr.sbin/amd | |
parent | d595e9967d4240c416842d8c95866128681401d3 (diff) |
Remove a bunch of NULL-checks before free().
Diffstat (limited to 'usr.sbin/amd')
-rw-r--r-- | usr.sbin/amd/amd/am_ops.c | 5 | ||||
-rw-r--r-- | usr.sbin/amd/amd/host_ops.c | 8 | ||||
-rw-r--r-- | usr.sbin/amd/amd/info_passwd.c | 5 | ||||
-rw-r--r-- | usr.sbin/amd/amd/map.c | 14 | ||||
-rw-r--r-- | usr.sbin/amd/amd/mapc.c | 5 | ||||
-rw-r--r-- | usr.sbin/amd/amd/mntfs.c | 10 | ||||
-rw-r--r-- | usr.sbin/amd/amd/nfsx_ops.c | 11 | ||||
-rw-r--r-- | usr.sbin/amd/amd/restart.c | 6 | ||||
-rw-r--r-- | usr.sbin/amd/amd/sfs_ops.c | 5 | ||||
-rw-r--r-- | usr.sbin/amd/amd/srvr_afs.c | 5 |
10 files changed, 30 insertions, 44 deletions
diff --git a/usr.sbin/amd/amd/am_ops.c b/usr.sbin/amd/amd/am_ops.c index aea892425f6..b668cc50468 100644 --- a/usr.sbin/amd/amd/am_ops.c +++ b/usr.sbin/amd/amd/am_ops.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)am_ops.c 8.1 (Berkeley) 6/6/93 - * $Id: am_ops.c,v 1.7 2014/10/26 03:08:21 guenther Exp $ + * $Id: am_ops.c,v 1.8 2015/12/05 21:15:01 mmcc Exp $ */ #include "am.h" @@ -153,8 +153,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, /* * Check the filesystem is happy */ - if (fo->fs_mtab) - free(fo->fs_mtab); + free(fo->fs_mtab); if ((fo->fs_mtab = (*rop->fs_match)(fo))) return rop; diff --git a/usr.sbin/amd/amd/host_ops.c b/usr.sbin/amd/amd/host_ops.c index 4710b6ac336..0045265b04d 100644 --- a/usr.sbin/amd/amd/host_ops.c +++ b/usr.sbin/amd/amd/host_ops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: host_ops.c,v 1.18 2014/10/26 03:00:35 guenther Exp $ */ +/* $OpenBSD: host_ops.c,v 1.19 2015/12/05 21:15:01 mmcc Exp $ */ /* * Copyright (c) 1990 Jan-Simon Pendry @@ -363,10 +363,8 @@ host_fmount(mntfs *mf) */ out: discard_mntlist(mlist); - if (ep) - free(ep); - if (fp) - free(fp); + free(ep); + free(fp); if (client) clnt_destroy(client); if (exlist) diff --git a/usr.sbin/amd/amd/info_passwd.c b/usr.sbin/amd/amd/info_passwd.c index 9f55e942838..2a70c22a2bd 100644 --- a/usr.sbin/amd/amd/info_passwd.c +++ b/usr.sbin/amd/amd/info_passwd.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)info_passwd.c 8.1 (Berkeley) 6/6/93 - * $Id: info_passwd.c,v 1.9 2014/10/20 02:33:42 guenther Exp $ + * $Id: info_passwd.c,v 1.10 2015/12/05 21:15:01 mmcc Exp $ */ /* @@ -143,8 +143,7 @@ passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp) } enoent: - if (dir) - free(dir); + free(dir); return ENOENT; } diff --git a/usr.sbin/amd/amd/map.c b/usr.sbin/amd/amd/map.c index 262c83a2905..cee89e94d10 100644 --- a/usr.sbin/amd/amd/map.c +++ b/usr.sbin/amd/amd/map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: map.c,v 1.15 2014/10/26 03:28:41 guenther Exp $ */ +/* $OpenBSD: map.c,v 1.16 2015/12/05 21:15:01 mmcc Exp $ */ /*- * Copyright (c) 1990 Jan-Simon Pendry @@ -333,14 +333,10 @@ free_map(am_node *mp) { remove_am(mp); - if (mp->am_link) - free(mp->am_link); - if (mp->am_name) - free(mp->am_name); - if (mp->am_path) - free(mp->am_path); - if (mp->am_pref) - free(mp->am_pref); + free(mp->am_link); + free(mp->am_name); + free(mp->am_path); + free(mp->am_pref); if (mp->am_mnt) free_mntfs(mp->am_mnt); diff --git a/usr.sbin/amd/amd/mapc.c b/usr.sbin/amd/amd/mapc.c index 4db212f33c9..9e546de92c4 100644 --- a/usr.sbin/amd/amd/mapc.c +++ b/usr.sbin/amd/amd/mapc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mapc.c,v 1.22 2014/10/26 03:28:41 guenther Exp $ */ +/* $OpenBSD: mapc.c,v 1.23 2015/12/05 21:15:01 mmcc Exp $ */ /*- * Copyright (c) 1989 Jan-Simon Pendry @@ -461,8 +461,7 @@ mapc_clear(mnt_map *m) while (k) { kv *n = k->next; free(k->key); - if (k->val) - free(k->val); + free(k->val); free(k); k = n; } diff --git a/usr.sbin/amd/amd/mntfs.c b/usr.sbin/amd/amd/mntfs.c index 63f11c9b3ef..65be1e58a58 100644 --- a/usr.sbin/amd/amd/mntfs.c +++ b/usr.sbin/amd/amd/mntfs.c @@ -205,10 +205,10 @@ new_mntfs() static void uninit_mntfs(mntfs *mf, int rmd) { - if (mf->mf_auto) free(mf->mf_auto); - if (mf->mf_mopts) free(mf->mf_mopts); - if (mf->mf_remopts) free(mf->mf_remopts); - if (mf->mf_info) free(mf->mf_info); + free(mf->mf_auto); + free(mf->mf_mopts); + free(mf->mf_remopts); + free(mf->mf_info); if (mf->mf_private && mf->mf_prfree) (*mf->mf_prfree)(mf->mf_private); /* @@ -216,7 +216,7 @@ uninit_mntfs(mntfs *mf, int rmd) */ if (rmd && (mf->mf_flags & MFF_MKMNT)) rmdirs(mf->mf_mount); - if (mf->mf_mount) free(mf->mf_mount); + free(mf->mf_mount); /* * Clean up the file server diff --git a/usr.sbin/amd/amd/nfsx_ops.c b/usr.sbin/amd/amd/nfsx_ops.c index 716baa75707..693786fb141 100644 --- a/usr.sbin/amd/amd/nfsx_ops.c +++ b/usr.sbin/amd/amd/nfsx_ops.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)nfsx_ops.c 8.1 (Berkeley) 6/6/93 - * $Id: nfsx_ops.c,v 1.9 2014/10/26 03:28:41 guenther Exp $ + * $Id: nfsx_ops.c,v 1.10 2015/12/05 21:15:01 mmcc Exp $ */ #include "am.h" @@ -220,15 +220,14 @@ nfsx_init(mntfs *mf) nx->nx_v[i].n_error = -1; nx->nx_v[i].n_mnt = find_mntfs(&nfs_ops, mf->mf_fo, mp, xinfo, "", mf->mf_mopts, mf->mf_remopts); } - if (rfs) free(rfs); - if (mp) free(mp); - if (xinfo) free(xinfo); + free(rfs); + free(mp); + free(xinfo); } free(ivec); errexit: - if (info) - free(info); + free(info); if (error) return error; } diff --git a/usr.sbin/amd/amd/restart.c b/usr.sbin/amd/amd/restart.c index 5f423340be6..44d3fc4c3e2 100644 --- a/usr.sbin/amd/amd/restart.c +++ b/usr.sbin/amd/amd/restart.c @@ -155,10 +155,8 @@ restart() /* * Clean up mo */ - if (mo.opt_rhost) - free(mo.opt_rhost); - if (mo.opt_rfs) - free(mo.opt_rfs); + free(mo.opt_rhost); + free(mo.opt_rfs); } } diff --git a/usr.sbin/amd/amd/sfs_ops.c b/usr.sbin/amd/amd/sfs_ops.c index 65ac0fa9972..eed719344a3 100644 --- a/usr.sbin/amd/amd/sfs_ops.c +++ b/usr.sbin/amd/amd/sfs_ops.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)sfs_ops.c 8.1 (Berkeley) 6/6/93 - * $Id: sfs_ops.c,v 1.4 2014/10/26 02:43:50 guenther Exp $ + * $Id: sfs_ops.c,v 1.5 2015/12/05 21:15:01 mmcc Exp $ */ #include "am.h" @@ -89,8 +89,7 @@ sfs_match(am_opts *fo) fullpath = strdup(fo->opt_fs); } - if (fo->opt_sublink) - free(fo->opt_sublink); + free(fo->opt_sublink); fo->opt_sublink = fullpath; fo->opt_fs = str3cat(fo->opt_fs, ".", fullpath, ""); } diff --git a/usr.sbin/amd/amd/srvr_afs.c b/usr.sbin/amd/amd/srvr_afs.c index f938a8d8ee2..3903421aa44 100644 --- a/usr.sbin/amd/amd/srvr_afs.c +++ b/usr.sbin/amd/amd/srvr_afs.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)srvr_afs.c 8.1 (Berkeley) 6/6/93 - * $Id: srvr_afs.c,v 1.7 2014/10/26 03:28:41 guenther Exp $ + * $Id: srvr_afs.c,v 1.8 2015/12/05 21:15:01 mmcc Exp $ */ /* @@ -123,8 +123,7 @@ timeout_srvr(void *arg) /* * Free the net address */ - if (fs->fs_ip) - free(fs->fs_ip); + free(fs->fs_ip); /* * Free the host name. |