Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys make sure every m_aux will be freed.
details: https://anonhg.NetBSD.org/src/rev/1f270dfa6e32
branches: trunk
changeset: 499222:1f270dfa6e32
user: itojun <itojun%NetBSD.org@localhost>
date: Tue Nov 14 20:05:28 2000 +0000
description:
make sure every m_aux will be freed.
there are direct use of MFREE() from sys/kern.
(we experienced no memory leak so far, but if we use m_aux for other purposes,
we will need this change)
diffstat:
sys/kern/uipc_mbuf.c | 6 +-----
sys/sys/mbuf.h | 10 +++++++++-
2 files changed, 10 insertions(+), 6 deletions(-)
diffs (48 lines):
diff -r ae4f4b67fa9a -r 1f270dfa6e32 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c Tue Nov 14 19:52:04 2000 +0000
+++ b/sys/kern/uipc_mbuf.c Tue Nov 14 20:05:28 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_mbuf.c,v 1.50 2000/08/18 16:19:22 itojun Exp $ */
+/* $NetBSD: uipc_mbuf.c,v 1.51 2000/11/14 20:05:28 itojun Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -347,10 +347,6 @@
if (m == NULL)
return;
- if ((m->m_flags & M_PKTHDR) != 0 && m->m_pkthdr.aux) {
- m_freem(m->m_pkthdr.aux);
- m->m_pkthdr.aux = NULL;
- }
do {
MFREE(m, n);
m = n;
diff -r ae4f4b67fa9a -r 1f270dfa6e32 sys/sys/mbuf.h
--- a/sys/sys/mbuf.h Tue Nov 14 19:52:04 2000 +0000
+++ b/sys/sys/mbuf.h Tue Nov 14 20:05:28 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mbuf.h,v 1.53 2000/08/18 16:19:23 itojun Exp $ */
+/* $NetBSD: mbuf.h,v 1.54 2000/11/14 20:05:28 itojun Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
@@ -395,10 +395,18 @@
* MFREE(struct mbuf *m, struct mbuf *n)
* Free a single mbuf and associated external storage.
* Place the successor, if any, in n.
+ *
+ * we do need to check non-first mbuf for m_aux, since some of existing
+ * code does not call M_PREPEND properly.
+ * (example: call to bpf_mtap from drivers)
*/
#define MFREE(m, n) \
MBUFLOCK( \
mbstat.m_mtypes[(m)->m_type]--; \
+ if (((m)->m_flags & M_PKTHDR) != 0 && (m)->m_pkthdr.aux) { \
+ m_freem((m)->m_pkthdr.aux); \
+ (m)->m_pkthdr.aux = NULL; \
+ } \
if ((m)->m_flags & M_EXT) { \
_MEXTREMOVE((m)); \
} \
Home |
Main Index |
Thread Index |
Old Index