svn commit: r237314 - projects/pf/head/sys/contrib/pf/net
Gleb Smirnoff
glebius at FreeBSD.org
Wed Jun 20 14:24:14 UTC 2012
Author: glebius
Date: Wed Jun 20 14:24:13 2012
New Revision: 237314
URL: http://svn.freebsd.org/changeset/base/237314
Log:
Don't leak mship in case if we specify syncpeer.
Modified:
projects/pf/head/sys/contrib/pf/net/if_pfsync.c
Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/if_pfsync.c Wed Jun 20 14:23:10 2012 (r237313)
+++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c Wed Jun 20 14:24:13 2012 (r237314)
@@ -1323,7 +1323,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cm
struct ip_moptions *imo = &sc->sc_imo;
struct ifnet *sifp;
struct ip *ip;
- void *mship;
+ void *mship = NULL;
if ((error = priv_check(curthread, PRIV_NETINET_PF)) != 0)
return (error);
@@ -1338,8 +1338,9 @@ pfsyncioctl(struct ifnet *ifp, u_long cm
else if ((sifp = ifunit_ref(pfsyncr.pfsyncr_syncdev)) == NULL)
return (EINVAL);
- mship = malloc((sizeof(struct in_multi *) *
- IP_MIN_MEMBERSHIPS), M_PFSYNC, M_WAITOK | M_ZERO);
+ if (pfsyncr.pfsyncr_syncpeer.s_addr == 0 && sifp != NULL)
+ mship = malloc((sizeof(struct in_multi *) *
+ IP_MIN_MEMBERSHIPS), M_PFSYNC, M_WAITOK | M_ZERO);
PFSYNC_LOCK(sc);
if (pfsyncr.pfsyncr_syncpeer.s_addr == 0)
@@ -1364,7 +1365,6 @@ pfsyncioctl(struct ifnet *ifp, u_long cm
if (imo->imo_membership)
pfsync_multicast_cleanup(sc);
PFSYNC_UNLOCK(sc);
- free(mship, M_PFSYNC);
break;
}
More information about the svn-src-projects
mailing list