diff TaskManager/kernel/ppe/MailManager.cc @ 643:2a611e8d8788 draft

minor fix.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 21 Nov 2009 10:57:37 +0900
parents ecf056ddd21a
children ed50fb6c84dd
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/MailManager.cc	Sat Nov 21 10:12:25 2009 +0900
+++ b/TaskManager/kernel/ppe/MailManager.cc	Sat Nov 21 10:57:37 2009 +0900
@@ -59,6 +59,10 @@
 void
 MailManager::free(MailQueuePtr q)
 {
+    if (MailManager::find(q,freeMailQueue)) {
+	fprintf(stderr,"double free %s\n",__FUNCTION__);
+	return;
+    }
     q->next = freeMailQueue;
     freeMailQueue = q;
 }
@@ -118,4 +122,16 @@
     return i;
 }
 
+int
+MailManager::find(MailQueuePtr q,MailQueuePtr list)
+{
+    MailQueuePtr p = list;
+    while(p) {
+	if (p==q)
+	    return -1; 
+        p = p->next;
+    }
+    return 0;
+}
+
 /* end */