The implementation of SO_PEERCRED is leaking mbufs. > netstat -m 5292 mbufs in use: 46 mbufs allocated to data 4 mbufs allocated to packet headers 43 mbufs allocated to socket names and addresses 5199 mbufs allocated to socket options and quite a few over some time > uptime 10:37PM up 10:25, 12 users, load averages: 0.29, 0.16, 0.10
This diff plugs this leak and stops my laptop from leaking. -- :wq Claudio Index: uipc_socket.c =================================================================== RCS file: /cvs/src/sys/kern/uipc_socket.c,v retrieving revision 1.89 diff -u -p -r1.89 uipc_socket.c --- uipc_socket.c 4 Apr 2011 11:10:26 -0000 1.89 +++ uipc_socket.c 4 Apr 2011 20:29:31 -0000 @@ -1567,15 +1573,17 @@ sogetopt(struct socket *so, int level, i struct unpcb *unp = sotounpcb(so); if (unp->unp_flags & UNP_FEIDS) { - *mp = m = m_get(M_WAIT, MT_SOOPTS); m->m_len = sizeof(unp->unp_connid); bcopy((caddr_t)(&(unp->unp_connid)), mtod(m, caddr_t), - (unsigned)m->m_len); - } else - return (ENOTCONN); - } else - return (EOPNOTSUPP); + m->m_len); + break; + } + (void)m_free(m); + return (ENOTCONN); + } + (void)m_free(m); + return (EOPNOTSUPP); break; default: