]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_apple_cspdl/lib/SSKey.cpp
Security-58286.20.16.tar.gz
[apple/security.git] / OSX / libsecurity_apple_cspdl / lib / SSKey.cpp
index 3fa1dfec556a5b5521145956d0587475fdfc19d3..89fd9145ff8972626ce73921884e38de3ed3799d 100644 (file)
@@ -236,12 +236,18 @@ mClientSession(session.clientSession())
 }
 
 SSKey::~SSKey()
-{
+try {
     StLock<Mutex> _(mMutex); // In the destructor too??? Yes. See SSCSPSession.cpp:354 for an explanation of this code's policy on threads.
        if (mKeyHandle != noKey)
                clientSession().releaseKey(mKeyHandle);
+} catch (...) {
+    /*
+     * If the key handle have been invalidated, releaseKey will throw an exception
+     */
+    return;
 }
 
+
 void
 SSKey::free(const AccessCredentials *accessCred, CssmKey &ioKey,
                        CSSM_BOOL deleteKey)