diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2011-10-24 16:32:55 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2011-10-24 16:48:49 -0500 |
commit | 97120135a331576b33982251ca586c04d2c41c87 (patch) | |
tree | f502428936db5d179a5da5844057c1c737e12278 /src/include/util | |
parent | 4962a22309cd7e3586aa57817689b18d67ca71c7 (diff) | |
download | talos-hostboot-97120135a331576b33982251ca586c04d2c41c87.tar.gz talos-hostboot-97120135a331576b33982251ca586c04d2c41c87.zip |
Remove dangling node pointer in pqueues.
Change-Id: Ic4852c3e0ba9a3fc4f489238a2b63eef5eca6fa2
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/456
Tested-by: Jenkins Server
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/util')
-rw-r--r-- | src/include/util/locked/pqueue.H | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/include/util/locked/pqueue.H b/src/include/util/locked/pqueue.H index 99a708b57..8e21a01d8 100644 --- a/src/include/util/locked/pqueue.H +++ b/src/include/util/locked/pqueue.H @@ -45,7 +45,7 @@ namespace Util void PQueue<_T,_K,locked,_S>::insert(_T* item) { this->__lock(); - + if (this->head == NULL) { item->next = item->prev = NULL; @@ -59,7 +59,7 @@ namespace Util bubbleUp(item); } - + this->__unlock(); } @@ -69,7 +69,7 @@ namespace Util _T* item = NULL; this->__lock(); - + if ((this->tail != NULL) && (this->tail->key <= key)) { item = this->tail; @@ -77,10 +77,13 @@ namespace Util this->head = this->tail = NULL; else this->tail = item->prev; + + if (item->prev) + item->prev->next = NULL; } this->__unlock(); - + return item; } @@ -90,7 +93,7 @@ namespace Util { if (!item->next) return; - + if (item->next->key <= item->key) return; @@ -98,7 +101,7 @@ namespace Util this->head = item->next; if (this->tail == item->next) this->tail = item; - + _T* temp = item->next; if (temp->next) |