From l.ertl@univie.ac.at  Tue Oct 28 06:55:44 2003
Return-Path: <l.ertl@univie.ac.at>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 673B916A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Oct 2003 06:55:44 -0800 (PST)
Received: from mailbox.univie.ac.at (mail.univie.ac.at [131.130.1.27])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 31F7B43FDD
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Oct 2003 06:55:43 -0800 (PST)
	(envelope-from l.ertl@univie.ac.at)
Received: from leelou.in.tern (adslle.cc.univie.ac.at [131.130.102.11])
	by mailbox.univie.ac.at (8.12.10/8.12.10) with ESMTP id h9SEtSXs319610
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Oct 2003 15:55:34 +0100
Received: (from le@localhost)
	by leelou.in.tern (8.12.10/8.12.10/Submit) id h9SEtSFI011115;
	Tue, 28 Oct 2003 15:55:28 +0100 (CET)
	(envelope-from le)
Message-Id: <200310281455.h9SEtSFI011115@leelou.in.tern>
Date: Tue, 28 Oct 2003 15:55:28 +0100 (CET)
From: Lukas Ertl <l.ertl@univie.ac.at>
Reply-To: Lukas Ertl <l.ertl@univie.ac.at>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] memory leak in geom_fox
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         58634
>Category:       kern
>Synopsis:       [PATCH] memory leak in geom_fox
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    le
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 28 07:00:34 PST 2003
>Closed-Date:    Sat Feb 07 03:12:28 PST 2004
>Last-Modified:  Sat Feb 07 03:12:28 PST 2004
>Originator:     Lukas Ertl
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Vienna University Computer Center
>Environment:
System: FreeBSD leelou 5.1-CURRENT FreeBSD 5.1-CURRENT #1: Sat Oct 18 19:54:15 CEST 2003 le@leelou:/usr/obj/usr/src/sys/LEELOU i386


	
>Description:

The g_fox_destroy_geom() routine deallocates and frees associated
structures, but happens to manually set a pointer to NULL and then pass
it to the g_free() routine.

>How-To-Repeat:
	
>Fix:

	

--- geom_fox.c.diff begins here ---
Index: sys/geom/geom_fox.c
===================================================================
RCS file: /hugo/bsdcvs/src/sys/geom/geom_fox.c,v
retrieving revision 1.3
diff -u -r1.3 geom_fox.c
--- sys/geom/geom_fox.c	24 Oct 2003 18:46:23 -0000	1.3
+++ sys/geom/geom_fox.c	28 Oct 2003 14:42:56 -0000
@@ -452,9 +452,9 @@
 
 	g_topology_assert();
 	sc = gp->softc;
-	gp->softc = NULL;
 	mtx_destroy(&sc->lock);
 	g_free(gp->softc);
+	gp->softc = NULL;
 	g_wither_geom(gp, ENXIO);
 	return (0);
 }
--- geom_fox.c.diff ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->phk 
Responsible-Changed-By: kris 
Responsible-Changed-When: Thu Oct 30 01:11:00 PST 2003 
Responsible-Changed-Why:  
phk committed the original version of this 

http://www.freebsd.org/cgi/query-pr.cgi?pr=58634 
State-Changed-From-To: open->closed 
State-Changed-By: le 
State-Changed-When: Sat Feb 7 03:11:13 PST 2004 
State-Changed-Why:  
Grab PR from phk and close it, because I have committed the patch. 


Responsible-Changed-From-To: phk->le 
Responsible-Changed-By: le 
Responsible-Changed-When: Sat Feb 7 03:11:13 PST 2004 
Responsible-Changed-Why:  
Grab PR from phk and close it, because I have committed the patch. 

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