Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Dec 2012 00:06:20 +0000 (UTC)
From:      Bryan Venteicher <bryanv@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r244328 - projects/vmxnet/sys/dev/vmware/vmxnet
Message-ID:  <201212170006.qBH06K0Y078513@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bryanv
Date: Mon Dec 17 00:06:20 2012
New Revision: 244328
URL: http://svnweb.freebsd.org/changeset/base/244328

Log:
  Fix mbuf leak in a very rare error case
  
  Approved by:	grehan (implicit)

Modified:
  projects/vmxnet/sys/dev/vmware/vmxnet/if_vic.c

Modified: projects/vmxnet/sys/dev/vmware/vmxnet/if_vic.c
==============================================================================
--- projects/vmxnet/sys/dev/vmware/vmxnet/if_vic.c	Mon Dec 17 00:04:43 2012	(r244327)
+++ projects/vmxnet/sys/dev/vmware/vmxnet/if_vic.c	Mon Dec 17 00:06:20 2012	(r244328)
@@ -1003,18 +1003,17 @@ vic_encap_load_mbuf(struct vic_softc *sc
 		return (error);
 
 	m = m_collapse(m, M_DONTWAIT, maxsegs);
-	if (m != NULL)
+	if (m != NULL) {
+		*m0 = m;
 		error = bus_dmamap_load_mbuf_sg(tag, dmap, m, segs, nsegs, 0);
-	else
+	} else
 		error = ENOBUFS;
 
 	if (error) {
 		m_freem(*m0);
-		m = NULL;
+		*m0 = NULL;
 	}
 
-	*m0 = m;
-
 	return (error);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212170006.qBH06K0Y078513>