Loading...
iokit/Kernel/IOPMchangeNoteList.cpp xnu-344.49 xnu-792.6.56
--- xnu/xnu-344.49/iokit/Kernel/IOPMchangeNoteList.cpp
+++ xnu/xnu-792.6.56/iokit/Kernel/IOPMchangeNoteList.cpp
@@ -2,8 +2,6 @@
  * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
- * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
  * 
  * This file contains Original Code and/or Modifications of Original Code
  * as defined in and that are subject to the Apple Public Source License
@@ -24,6 +22,7 @@
  */
 #include <IOKit/pwr_mgt/IOPM.h>
 #include <IOKit/pwr_mgt/IOPMchangeNoteList.h>
+#include <IOKit/pwr_mgt/IOPowerConnection.h>
 
 #define super OSObject
 OSDefineMetaClassAndStructors(IOPMchangeNoteList,OSObject)
@@ -107,6 +106,13 @@
 
 IOReturn IOPMchangeNoteList::releaseHeadChangeNote ( void )
 {
+    IOPowerConnection *tmp;
+
+    if((tmp = changeNote[firstInList].parent)) {
+       changeNote[firstInList].parent = 0;
+       tmp->release();
+    }
+
     changeNote[firstInList].flags = IOPMNotInUse;
     firstInList = increment(firstInList);
     return IOPMNoErr;
@@ -124,6 +130,13 @@
 
 IOReturn IOPMchangeNoteList::releaseTailChangeNote ( void )
 {
+    IOPowerConnection *tmp;
+    
+    if((tmp = changeNote[firstInList].parent)) {
+       changeNote[firstInList].parent = 0;
+       tmp->release();
+    }
+
     firstUnused = decrement(firstUnused);
     changeNote[firstUnused].flags = IOPMNotInUse;
     return IOPMNoErr;