error out earlier in get_chain_X509

This commit is contained in:
toddouska 2013-04-23 13:21:00 -07:00
parent bad1c32df2
commit 65913b0d6c
1 changed files with 2 additions and 0 deletions

View File

@ -8620,12 +8620,14 @@ CYASSL_X509* CyaSSL_get_chain_X509(CYASSL_X509_CHAIN* chain, int idx)
if (ret != 0) {
CYASSL_MSG("Failed to parse cert");
FreeDecodedCert(&dCert);
return NULL;
}
x509 = (CYASSL_X509*)XMALLOC(sizeof(CYASSL_X509), NULL, DYNAMIC_TYPE_X509);
if (x509 == NULL) {
CYASSL_MSG("Failed alloc X509");
FreeDecodedCert(&dCert);
return NULL;
}
InitX509(x509, 1);