From antoine@peanut.dreadbsd.org  Thu Dec  8 19:01:07 2005
Return-Path: <antoine@peanut.dreadbsd.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B637016A420
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  8 Dec 2005 19:01:07 +0000 (GMT)
	(envelope-from antoine@peanut.dreadbsd.org)
Received: from barton.dreadbsd.org (peanut.dreadbsd.org [82.67.196.50])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6495343D5D
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  8 Dec 2005 19:00:51 +0000 (GMT)
	(envelope-from antoine@peanut.dreadbsd.org)
Received: from barton.dreadbsd.org (localhost [127.0.0.1])
	by barton.dreadbsd.org (8.13.4/8.13.4) with ESMTP id jB8J0ltY024710
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 8 Dec 2005 20:00:48 +0100 (CET)
	(envelope-from antoine@peanut.dreadbsd.org)
Received: (from antoine@localhost)
	by barton.dreadbsd.org (8.13.4/8.13.1/Submit) id jB8J0lM6024709;
	Thu, 8 Dec 2005 20:00:47 +0100 (CET)
	(envelope-from antoine)
Message-Id: <200512081900.jB8J0lM6024709@barton.dreadbsd.org>
Date: Thu, 8 Dec 2005 20:00:47 +0100 (CET)
From: Antoine Brodin <antoine.brodin@laposte.net>
Reply-To: Antoine Brodin <antoine.brodin@laposte.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] memory leak in ng_hole(4)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         90113
>Category:       kern
>Synopsis:       [netgraph] [patch] memory leak in ng_hole(4)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 08 19:10:02 GMT 2005
>Closed-Date:    Fri Dec 09 07:15:35 GMT 2005
>Last-Modified:  Fri Dec 09 07:15:35 GMT 2005
>Originator:     Antoine Brodin
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
none
>Environment:
System: FreeBSD barton.dreadbsd.org 7.0-CURRENT FreeBSD 7.0-CURRENT #1: Sat Dec 3 16:06:36 CET 2005 root@barton.dreadbsd.org:/usr/obj/usr/src/sys/BARTON i386


>Description:
There's a memory leak in ng_hole(4). When a hook is disconnected, the statistics
about this hook are not freed.
>How-To-Repeat:
Use ng_hole(4).
After that, do a `vmstat -m | grep netgraph` after shutting down everything
>Fix:


--- ng_hole.diff begins here ---
Index: netgraph/ng_hole.c
===================================================================
RCS file: /home/ncvs/src/sys/netgraph/ng_hole.c,v
retrieving revision 1.14
diff -u -p -r1.14 ng_hole.c
--- netgraph/ng_hole.c	7 Jan 2005 01:45:39 -0000	1.14
+++ netgraph/ng_hole.c	8 Dec 2005 18:42:13 -0000
@@ -219,6 +219,7 @@ static int
 ngh_disconnect(hook_p hook)
 {
 
+	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_hole.diff ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Fri Dec 9 07:13:32 GMT 2005 
State-Changed-Why:  
Committed (to HEAD and RELENG_[456]), thanks! 


Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Fri Dec 9 07:13:32 GMT 2005 
Responsible-Changed-Why:  

http://www.freebsd.org/cgi/query-pr.cgi?pr=90113 
>Unformatted:
