From owner-freebsd-net Sat Aug 10 13:21: 8 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 777BE37B400; Sat, 10 Aug 2002 13:21:05 -0700 (PDT) Received: from scaup.mail.pas.earthlink.net (scaup.mail.pas.earthlink.net [207.217.120.49]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2422143E65; Sat, 10 Aug 2002 13:21:05 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0086.cvx21-bradley.dialup.earthlink.net ([209.179.192.86] helo=mindspring.com) by scaup.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17dcj7-0003hr-00; Sat, 10 Aug 2002 13:20:46 -0700 Message-ID: <3D557563.D1FC72B8@mindspring.com> Date: Sat, 10 Aug 2002 13:19:47 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: FUJITA Kazutoshi Cc: freebsd-net@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: m_freem() in tcp_respond() References: <20020811.040808.74720123.fujita@soum.co.jp> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org FUJITA Kazutoshi wrote: > --- /sys/netinet/tcp_subr.c.ORG Thu Jul 18 19:47:04 2002 > +++ /sys/netinet/tcp_subr.c Sun Aug 11 04:00:09 2002 > @@ -393,7 +393,8 @@ > bcopy((caddr_t)th, (caddr_t)nth, sizeof(struct tcphdr)); > flags = TH_ACK; > } else { > - m_freem(m->m_next); > + if (m->m_next) > + m_freem(m->m_next); > m->m_next = 0; > m->m_data = (caddr_t)ipgen; > /* m_len is set later */ NO. It is better to know that it's not NULL before it gets there. If you check everything everywhere to see if it's NULL before you do anything, then you are going to speen all your time comparing things to NULL, rather than doing real work. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message