kern/93952: [netgraph][patch] memory leak in ng_tcpmss.c

Antoine Brodin antoine.brodin at laposte.net
Tue Feb 28 11:00:22 PST 2006


>Number:         93952
>Category:       kern
>Synopsis:       [netgraph][patch] memory leak in ng_tcpmss.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 28 19:00:18 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Antoine Brodin
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
none
>Environment:
System: FreeBSD barton.dreadbsd.org 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Wed Feb 22 20:15:40 CET 2006 antoine at barton.dreadbsd.org:/usr/obj/usr/src/sys/BARTON i386
>Description:
This problem concerns ng_tcpmss(4).
On hook disconnection, the per hook info which contains
the output hook and the hook stats is not freed.
>How-To-Repeat:
Use the example in ng_tcpmss man page, shutdown and unload
everything, then vmstat -m | grep netgraph
>Fix:


--- ng_tcpmss.c.diff begins here ---
Index: sys/netgraph/ng_tcpmss.c
===================================================================
RCS file: /home/ncvs/src/sys/netgraph/ng_tcpmss.c,v
retrieving revision 1.2
diff -u -p -r1.2 ng_tcpmss.c
--- sys/netgraph/ng_tcpmss.c	10 Jun 2005 12:44:21 -0000	1.2
+++ sys/netgraph/ng_tcpmss.c	28 Feb 2006 18:02:03 -0000
@@ -368,6 +368,8 @@ ng_tcpmss_disconnect(hook_p hook)
 			priv->outHook = NULL;
 	}
 
+	FREE(NG_HOOK_PRIVATE(hook), M_NETGRAPH);
+	NG_HOOK_SET_PRIVATE(hook, NULL);
 	if (NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0)
 		ng_rmnode_self(NG_HOOK_NODE(hook));
 
--- ng_tcpmss.c.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list