Fix a mbuf leak in ip_output().

Scenario: If ip_insertoptions() prepends a new mbuf to the chain, the
bad: label's m_freem(m0) still would free only the original mbuf chain
if the transmission failed for, e.g., no route to host; resulting in
one lost mbuf per failed packet. (The original posting included a
demonstration program).

Original report of this bug was by jinmei@isl.rdc.toshiba.co.jp
(JINMEI Tatuya) on comp.bugs.4bsd.
This commit is contained in:
is 1996-10-11 18:19:08 +00:00
parent 21526da6c8
commit 08899f4a1b

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_output.c,v 1.32 1996/09/14 14:40:27 mrg Exp $ */
/* $NetBSD: ip_output.c,v 1.33 1996/10/11 18:19:08 is Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -428,7 +428,7 @@ bad:
ip = mtod(m = m1, struct ip *);
}
#endif /* PFIL_HOOKS */
m_freem(m0);
m_freem(m);
goto done;
}