]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_cms/lib/CMSDecoder.cpp
Security-57740.51.3.tar.gz
[apple/security.git] / OSX / libsecurity_cms / lib / CMSDecoder.cpp
index a8d81d095e1077a502396eb4412331b9367cd076..dcb79035d9ea57aaa32b67ab183117b12dd6648e 100644 (file)
@@ -127,19 +127,20 @@ static void cmsDecoderFinalize(
        if(cmsDecoder->decoder != NULL) {
                /*
                 * Normally this gets freed in SecCmsDecoderFinish - this is
-                * an error case.
-                * FIXME: SecCmsDecoderDestroy() appears to destroy the
-                * cmsMsg too! Plus there's a comment there re: a leak...
+                * an error case. Unlike Finish, this calls SecCmsMessageDestroy.
                 */
                SecCmsDecoderDestroy(cmsDecoder->decoder);
+               cmsDecoder->cmsMsg = NULL;
        }
        CFRELEASE(cmsDecoder->detachedContent);
        CFRELEASE(cmsDecoder->keychainOrArray);
        if(cmsDecoder->cmsMsg != NULL) {
                SecCmsMessageDestroy(cmsDecoder->cmsMsg);
+               cmsDecoder->cmsMsg = NULL;
        }
        if(cmsDecoder->arena != NULL) {
                SecArenaPoolFree(cmsDecoder->arena, false);
+               cmsDecoder->arena = NULL;
        }
 }