Loading...
libkern/c++/OSArray.cpp xnu-4570.41.2 xnu-3248.30.4
--- xnu/xnu-4570.41.2/libkern/c++/OSArray.cpp
+++ xnu/xnu-3248.30.4/libkern/c++/OSArray.cpp
@@ -185,7 +185,7 @@
 {
     const OSMetaClassBase **newArray;
     unsigned int finalCapacity;
-    vm_size_t    oldSize, newSize;
+    unsigned int oldSize, newSize;
 
     if (newCapacity <= capacity)
         return capacity;
@@ -200,11 +200,8 @@
 
     newSize = sizeof(const OSMetaClassBase *) * finalCapacity;
 
-    newArray = (const OSMetaClassBase **) kallocp_container(&newSize);
+    newArray = (const OSMetaClassBase **) kalloc_container(newSize);
     if (newArray) {
-        // use all of the actual allocation size
-        finalCapacity = newSize / sizeof(const OSMetaClassBase *);
-
         oldSize = sizeof(const OSMetaClassBase *) * capacity;
 
         OSCONTAINER_ACCUMSIZE(((size_t)newSize) - ((size_t)oldSize));
@@ -266,9 +263,6 @@
 
     if (!otherCount)
         return true;
-
-    if (newCount < count)
-        return false;
 
     // do we need more space?
     if (newCount > capacity && newCount > ensureCapacity(newCount))