diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-10 09:13:27 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-10 09:13:27 +0000 |
commit | 170804640c53feb6b60b14bae8a8633e8b949911 (patch) | |
tree | bc1a1a9dca7baee7582287f85ddeb282883b0e5f /sys/netinet/ip_icmp.c | |
parent | 8e7db6a9c6de7e28aaf5ac6d45833bf594f45902 (diff) |
prevent mbuf leak on icmp_do_error() failure.
NOTE: under 4.4BSD mbuf coding discipline, once you pass mbuf to a function
like f(m), you no longer have ownership of the mbuf. the mbuf will always
be freed by the called function f(). by keeping the programming rule
you have less chance of memory leak.
Diffstat (limited to 'sys/netinet/ip_icmp.c')
-rw-r--r-- | sys/netinet/ip_icmp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index f9625017fda..af50040940a 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.51 2002/06/09 16:26:10 itojun Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.52 2002/06/10 09:13:26 itojun Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -267,6 +267,7 @@ icmp_do_error(n, type, code, dest, destifp) m_tag_prepend(m, mtag); } + m_freem(n); return (m); freeit: @@ -292,7 +293,6 @@ icmp_error(n, type, code, dest, destifp) m = icmp_do_error(n, type, code, dest, destifp); if (m != NULL) icmp_reflect(m); - m_freem(n); } static struct sockaddr_in icmpsrc = { sizeof (struct sockaddr_in), AF_INET }; |