]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_transform/lib/Source.cpp
Security-58286.70.7.tar.gz
[apple/security.git] / OSX / libsecurity_transform / lib / Source.cpp
index ad26b5b43ab44efdf0c4d396858341841b1d8f7b..3bdbe5c7355a77d784f0793d630aada80159d393 100644 (file)
@@ -17,7 +17,7 @@ Source::Source(CFStringRef sourceObjectName, Transform* destination, CFStringRef
        mLastValue = NULL;
        mDispatchQueue = MyDispatchQueueCreate(queueName_cstr, NULL);
     free((void*)queueName_cstr);
-    CFRelease(queueName);
+    CFReleaseNull(queueName);
 }
 
 
@@ -26,7 +26,7 @@ Source::~Source()
 {
        if (mLastValue != NULL)
        {
-               CFRelease(mLastValue);
+               CFReleaseNull(mLastValue);
        }
        
        dispatch_release(mDispatchQueue);
@@ -48,19 +48,10 @@ void Source::SetValue(CFTypeRef value)
                return;
        }
        
-       if (mLastValue != NULL) // is there an existing value?  If so, release it
-       {
-               CFRelease(mLastValue);
-       }
-       
-       if (value != NULL)
-       {
-               mLastValue = CFRetain(value);
-       }
-       else
-       {
-               mLastValue = NULL;
-       }
+       // is there an existing value?  If so, release it
+    CFReleaseNull(mLastValue);
+
+    mLastValue = CFRetainSafe(value);
 }