Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Fix memory leak, we may reallocate 'tcp_saveti' ...



details:   https://anonhg.NetBSD.org/src/rev/246fd9506714
branches:  trunk
changeset: 831415:246fd9506714
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Mar 29 17:09:00 2018 +0000

description:
Fix memory leak, we may reallocate 'tcp_saveti' after 'findpcb'. It's not
a tragic bug, because it happens only on sockets with debug enabled.

diffstat:

 sys/netinet/tcp_input.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 4dffc26e9f3c -r 246fd9506714 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Thu Mar 29 17:01:46 2018 +0000
+++ b/sys/netinet/tcp_input.c   Thu Mar 29 17:09:00 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.396 2018/03/29 17:01:46 maxv Exp $     */
+/*     $NetBSD: tcp_input.c,v 1.397 2018/03/29 17:09:00 maxv Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.396 2018/03/29 17:01:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.397 2018/03/29 17:09:00 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2348,6 +2348,8 @@
                            SEQ_GT(th->th_seq, tp->rcv_nxt)) {
                                tp = tcp_close(tp);
                                tcp_fields_to_net(th);
+                               m_freem(tcp_saveti);
+                               tcp_saveti = NULL;
                                goto findpcb;
                        }
 



Home | Main Index | Thread Index | Old Index