]> git.saurik.com Git - apple/xnu.git/blobdiff - libkern/c++/OSSymbol.cpp
xnu-2422.1.72.tar.gz
[apple/xnu.git] / libkern / c++ / OSSymbol.cpp
index d2eca1bf7650696f94e09a8325a0b0e0fab55424..c90107c1ba75293d7e9439512ba2056f5117ff37 100644 (file)
@@ -40,7 +40,7 @@ __END_DECLS
 
 #define super OSString
 
-typedef struct { int i, j; } OSSymbolPoolState;
+typedef struct { unsigned int i, j; } OSSymbolPoolState;
 
 #if OSALLOCDEBUG
 extern "C" {
@@ -172,6 +172,13 @@ OSSymbolPool::OSSymbolPool(const OSSymbolPool *old)
 OSSymbolPool::~OSSymbolPool()
 {
     if (buckets) {
+        Bucket *thisBucket;
+        for (thisBucket = &buckets[0]; thisBucket < &buckets[nBuckets]; thisBucket++) {
+            if (thisBucket->count > 1) {
+                kfree(thisBucket->symbolP, thisBucket->count * sizeof(OSSymbol *));
+                ACCUMSIZE(-(thisBucket->count * sizeof(OSSymbol *)));
+            }
+        }
         kfree(buckets, nBuckets * sizeof(Bucket));
         ACCUMSIZE(-(nBuckets * sizeof(Bucket)));
     }
@@ -363,7 +370,7 @@ void OSSymbolPool::removeSymbol(OSSymbol *sym)
 
     if (!j) {
        // couldn't find the symbol; probably means string hash changed
-        panic("removeSymbol");
+        panic("removeSymbol %s count %d ", sym->string ? sym->string : "no string", count);
         return;
     }
 
@@ -378,7 +385,7 @@ void OSSymbolPool::removeSymbol(OSSymbol *sym)
             return;
         }
        // couldn't find the symbol; probably means string hash changed
-       panic("removeSymbol");
+       panic("removeSymbol %s count %d ", sym->string ? sym->string : "no string", count);
         return;
     }
 
@@ -405,7 +412,7 @@ void OSSymbolPool::removeSymbol(OSSymbol *sym)
             return;
         }
        // couldn't find the symbol; probably means string hash changed
-       panic("removeSymbol");
+       panic("removeSymbol %s count %d ", sym->string ? sym->string : "no string", count);
         return;
     }
 
@@ -432,7 +439,7 @@ void OSSymbolPool::removeSymbol(OSSymbol *sym)
         }
     }
     // couldn't find the symbol; probably means string hash changed
-    panic("removeSymbol");
+    panic("removeSymbol %s count %d ", sym->string ? sym->string : "no string", count);
 }
 
 /*