diff options
author | Elio Maldonado <emaldona@redhat.com> | 2015-04-16 20:14:54 -0700 |
---|---|---|
committer | Elio Maldonado <emaldona@redhat.com> | 2015-04-16 20:14:54 -0700 |
commit | 775c70de5d2508d4339aeea73311b9820c722937 (patch) | |
tree | 39ee8874cf23c69ec05fd7fb0e451186fd36dd54 /lib/smime | |
parent | 43deb3a0206428de8199b303c02c5cd27635567a (diff) | |
download | nss-hg-775c70de5d2508d4339aeea73311b9820c722937.tar.gz |
Bug 1054069 - Address coverity scan reported flaws, r=wtc
Diffstat (limited to 'lib/smime')
-rw-r--r-- | lib/smime/cmsmessage.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/smime/cmsmessage.c b/lib/smime/cmsmessage.c index 72026e6ca..a44fb0b5c 100644 --- a/lib/smime/cmsmessage.c +++ b/lib/smime/cmsmessage.c @@ -28,26 +28,26 @@ NSS_CMSMessage_Create(PLArenaPool *poolp) PRBool poolp_is_ours = PR_FALSE; if (poolp == NULL) { - poolp = PORT_NewArena (1024); /* XXX what is right value? */ - if (poolp == NULL) - return NULL; - poolp_is_ours = PR_TRUE; - } + poolp = PORT_NewArena (1024); /* XXX what is right value? */ + if (poolp == NULL) + return NULL; + poolp_is_ours = PR_TRUE; + } if (!poolp_is_ours) - mark = PORT_ArenaMark(poolp); - - cmsg = (NSSCMSMessage *)PORT_ArenaZAlloc (poolp, sizeof(NSSCMSMessage)); - if (cmsg == NULL) { - if (!poolp_is_ours) { - if (mark) { - PORT_ArenaRelease(poolp, mark); - } - } else - PORT_FreeArena(poolp, PR_FALSE); - return NULL; + mark = PORT_ArenaMark(poolp); + + cmsg = (NSSCMSMessage *)PORT_ArenaZAlloc(poolp, sizeof(NSSCMSMessage)); + if (cmsg == NULL || + NSS_CMSContentInfo_Private_Init(&(cmsg->contentInfo)) != SECSuccess) { + if (!poolp_is_ours) { + if (mark) { + PORT_ArenaRelease(poolp, mark); + } + } else + PORT_FreeArena(poolp, PR_FALSE); + return NULL; } - NSS_CMSContentInfo_Private_Init(&(cmsg->contentInfo)); cmsg->poolp = poolp; cmsg->poolp_is_ours = poolp_is_ours; |