]> git.saurik.com Git - apple/security.git/blobdiff - libsecurity_utilities/lib/cfclass.cpp
Security-55471.14.8.tar.gz
[apple/security.git] / libsecurity_utilities / lib / cfclass.cpp
index cfd80514ef57cf64e922439ae72d6d892a893937..d635ca44d7b203de1bef7fe6d93e2c7541099dea 100644 (file)
@@ -103,9 +103,17 @@ CFClass::cleanupObject(intptr_t op, CFTypeRef cf, bool &zap)
     }
     else if (currentCount == 0)
     {
-        finalizeType(cf);
-        zap = true; // the the caller to release the mutex and zap the object
-        return 0;
+        // we may not be able to delete if the caller has active children
+        if (obj->mayDelete())
+        {
+            finalizeType(cf);
+            zap = true; // ask the caller to release the mutex and zap the object
+            return 0;
+        }
+        else
+        {
+            return currentCount;
+        }
     }
     else 
     {