]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_smime/lib/cmsmessage.c
Security-58286.260.20.tar.gz
[apple/security.git] / OSX / libsecurity_smime / lib / cmsmessage.c
index 816ce4af783cae71a5f253ee0db95f91e6436a14..387fb52c90644cea9a55e31f6a0c9d904018b6eb 100644 (file)
@@ -58,7 +58,7 @@ SecCmsMessageCreate(SecArenaPoolRef pool)
 {
     PLArenaPool *poolp = (PLArenaPool *)pool;
     void *mark = NULL;
-    SecCmsMessageRef cmsg;
+    SecCmsMessageRef cmsg = NULL;
     Boolean poolp_is_ours = PR_FALSE;
 
     if (poolp == NULL) {
@@ -135,8 +135,9 @@ SecCmsMessageDestroy(SecCmsMessageRef cmsg)
     SecCmsContentInfoDestroy(&(cmsg->contentInfo));
 
     /* if poolp is not NULL, cmsg is the owner of its arena */
-    if (cmsg->poolp_is_ours)
-       PORT_FreeArena (cmsg->poolp, PR_FALSE); /* XXX clear it? */
+    if (cmsg->poolp_is_ours && cmsg->poolp) {
+       PORT_FreeArena (cmsg->poolp, PR_TRUE);
+    }
 }
 
 /*