changeset 5020:c83a5a43af69

6600176 ppm_manage_cpus() leaks memory when noone is watching 6600334 pm_register_watcher() leaks memory if same process watches more than two devices
author mh27603
date Mon, 10 Sep 2007 14:18:22 -0700
parents cfc9eff7091a
children 86546f219f69
files usr/src/uts/common/os/sunpm.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/os/sunpm.c	Mon Sep 10 12:54:12 2007 -0700
+++ b/usr/src/uts/common/os/sunpm.c	Mon Sep 10 14:18:22 2007 -0700
@@ -5513,10 +5513,10 @@
 			 * process is watching multiple devices)
 			 */
 			if (p->pscc_clone == clone) {
-				ASSERT(p->pscc_dip != dip);
 				pscc->pscc_entries = p->pscc_entries;
 				pscc->pscc_entries->psce_references++;
 				found++;
+				break;
 			}
 		}
 		if (!found) {		/* create a new one */
@@ -8516,7 +8516,7 @@
 {
 	_NOTE(ARGUNUSED(impl_arg))
 	PMD_FUNC(pmf, "bp_set_power")
-	pm_ppm_devlist_t *devl;
+	pm_ppm_devlist_t *devl = NULL;
 	int clevel, circ;
 #ifdef	DEBUG
 	int circ_db, ccirc_db;
@@ -8802,6 +8802,14 @@
 			    old, canblock);
 			pm_enqueue_notify_others(&devl, canblock);
 			mutex_exit(&pm_rsvp_lock);
+		} else {
+			pm_ppm_devlist_t *p;
+			pm_ppm_devlist_t *next;
+			for (p = devl; p != NULL; p = next) {
+				next = p->ppd_next;
+				kmem_free(p, sizeof (pm_ppm_devlist_t));
+			}
+			devl = NULL;
 		}
 
 		/*