Module Name:    src
Committed By:   dyoung
Date:           Tue Apr  7 21:47:58 UTC 2009

Modified Files:
        src/sys/arch/x86/x86: ipmi.c

Log Message:
When ipmi0 detaches, free all of the ipmi_sensor's on the (global!)
ipmi_sensor_list.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/x86/ipmi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/ipmi.c
diff -u src/sys/arch/x86/x86/ipmi.c:1.31 src/sys/arch/x86/x86/ipmi.c:1.32
--- src/sys/arch/x86/x86/ipmi.c:1.31	Tue Apr  7 21:00:30 2009
+++ src/sys/arch/x86/x86/ipmi.c	Tue Apr  7 21:47:58 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipmi.c,v 1.31 2009/04/07 21:00:30 dyoung Exp $ */
+/*	$NetBSD: ipmi.c,v 1.32 2009/04/07 21:47:58 dyoung Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.31 2009/04/07 21:00:30 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.32 2009/04/07 21:47:58 dyoung Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1859,6 +1859,7 @@
 static int
 ipmi_detach(device_t self, int flags)
 {
+	struct ipmi_sensor *i;
 	int rc;
 	struct ipmi_softc *sc = device_private(self);
 
@@ -1887,6 +1888,11 @@
 		sc->sc_envsys = NULL;
 	}
 
+	while ((i = SLIST_FIRST(&ipmi_sensor_list)) != NULL) {
+		SLIST_REMOVE_HEAD(&ipmi_sensor_list, i_list);
+		free(i, M_DEVBUF);
+	}
+
 	if (sc->sc_sensor != NULL) {
 		free(sc->sc_sensor, M_DEVBUF);
 		sc->sc_sensor = NULL;

Reply via email to