From 1eb9ea583b8b8719c7d459fb8337cab47fef276a Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:34 +0000 Subject: [PATCH] Remove check for NULL prior to free(9) and m_freem(9). Approved by: cperciva (mentor) --- sys/compat/linprocfs/linprocfs.c | 6 ++---- sys/compat/linux/linux_file.c | 3 +-- sys/compat/linux/linux_socket.c | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index d86da04a3065..bb21d8ae538c 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -386,8 +386,7 @@ linprocfs_domtab(PFS_FILL_ARGS) sbuf_printf(sb, " 0 0\n"); } mtx_unlock(&mountlist_mtx); - if (flep != NULL) - free(flep, M_TEMP); + free(flep, M_TEMP); return (error); } @@ -447,8 +446,7 @@ linprocfs_dopartitions(PFS_FILL_ARGS) } g_topology_unlock(); - if (flep != NULL) - free(flep, M_TEMP); + free(flep, M_TEMP); return (error); } diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 346d1781d782..7e4ac380825e 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -517,8 +517,7 @@ getdents_common(struct thread *td, struct linux_getdents64_args *args, td->td_retval[0] = nbytes - resid; out: - if (cookies) - free(cookies, M_TEMP); + free(cookies, M_TEMP); VOP_UNLOCK(vp, 0); foffset_unlock(fp, off, 0); diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index cd288f8edd8a..36b23acec4a6 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1443,10 +1443,8 @@ linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args) bad: free(iov, M_IOV); - if (control != NULL) - m_freem(control); - if (linux_cmsg != NULL) - free(linux_cmsg, M_TEMP); + m_freem(control); + free(linux_cmsg, M_TEMP); return (error); }