Merge pull request #1412 from JacobBarthelmeh/PKCS12

clean up memory in error case with PKCS12 create
This commit is contained in:
toddouska 2018-03-02 12:37:12 -08:00 committed by GitHub
commit 48cd2806af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18268,12 +18268,14 @@ WC_PKCS12* wolfSSL_PKCS12_create(char* pass, char* name,
curDer = (byte*)wolfSSL_X509_get_der(sk->data.x509, &curDerSz);
if (certDer == NULL || curDerSz < 0) {
XFREE(cur, NULL, DYNAMIC_TYPE_PKCS);
wc_FreeCertList(list, NULL);
return NULL;
}
cur->buffer = (byte*)XMALLOC(curDerSz, NULL, DYNAMIC_TYPE_PKCS);
if (cur->buffer == NULL) {
XFREE(cur, NULL, DYNAMIC_TYPE_PKCS);
wc_FreeCertList(list, NULL);
return NULL;
}