kern/58634: [PATCH] memory leak in geom_fox

Lukas Ertl l.ertl at univie.ac.at
Tue Oct 28 07:00:37 PST 2003


>Number:         58634
>Category:       kern
>Synopsis:       [PATCH] memory leak in geom_fox
>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 Oct 28 07:00:34 PST 2003
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list